closing out and end game logic added