osx: proper cleanup/save on quit