Implemented before destroy callback to Task object.