Closing a widget doesn't quit the application if more widgets are still there.
If you want that, you should implement the main window close event and handle the closing of all open windows, saving settings and quiting the app.