Close the loaded resident module on the destructor.