Used Events to properly close Pygame when the user asks to exit.