save changes prior to cleanup