Correct module shutdown sequence, to prevent potential PlugIn crash.