Created a proper way to close the game