fixed clean shutdown on iOS/Mac