move the declaration of self._closed above the import, so that if the import fails you don't get an error in th destructor