Apply cleanup at appropriate time