Improve error checking and handling around storage

This will ensure a plugin which failed to successfully run it's activate
stage causes an exception when trying to close storage during deactivate.