Executed when the user tries to close the window
Allows the application to close and decide if it can exit
See Implementation