Be better at handling errors during shutdown
Be better at handling errors during shutdown

 - Don't try and show a dialog if the application is exiting
 - Flush the log after writing an error, in case we crash straight after

This will help in debugging #15

canton7/SyncTrayzor,canton7/SyncTrayzor,canton7/SyncTrayzor