I think I discovered why the game sometimes doesn’t end. When I clicked to the main menu after getting an ending and started again, it counted from the last game. So this time, it began with First Day, Day 8, Day 9, etc. The game is probably set to end at day 7, which never comes. The game still ended when I killed the last two survivors with the gun.
I hope this helps if you plan to continue working on this!