Try to fix crash on exit with the preferences dialog open (only appears on OS X).