Fixed a warning on closing invalid plugins.