//Stops the game before the form is closed,and therefore before any exceptions can occur. private void GameWindow_FormClosing(object sender, FormClosingEventArgs e) { game.stopGame(); }