Sync changes before leaving