Now the app closes when the window is closed