proper quit handling for mac app