zawran #1 I think you need to catch the event that someone click on the X button and then do appterminate()