Fixing rare crash on quit on Mac OS X