osx: cleanup/terminate improvements