Now handles when the user clicks on the window's close button