Abort sync operations on termination
Fix termination code