Don't try to close a shelf when self.shelf doesn't exist

This may happen if a plugin fails in it's activation stage