finish game logic