Close app if close event received when in tray

If anki is in the tray icon, the close event can't come from the X button. In this case a close event can come from the OS that is closing all the application before shutting down, so the event can be accepted in order to close anki. To prevent data loss when the system shutdown and anki is in the tray, the collection is saved each time anki is minimized in the tray.

Thanks to Adriano Bedeschi for the improvement.