Made sure the server closes when exiting the game