A destructor is a special type of method that is executed when a class-based object is deleted, either as a result of automatic garbage collection, or programmatically using the DELETE OBJECT statement. Destructors do not have parameters and do not have a return type. In a hierarchy, all destructors of the classes in the hierarchy are executed.
This is a good place to put cleanup code that you want to ensure is run before the class-based object is deleted. That is, unless the entire session ends abnormally, in which case the destructor might not run.