Added WindowListener for a clean termination of the game