Removing the module from the list of modules in the destructor