How do I catch the signal from the main application 'X' button, used to terminate the application?