handle ending the game