use CODE tags when pasting code.

And I can't see any close/quit button in your code. What you have pasted is rather not useful. Try showing us more code to get some idea how do you close your app, what do you do in constructor etc. because there is the cause of your problem.