revert close function