diff --git a/nilmdb/utils/mustclose.py b/nilmdb/utils/mustclose.py index f41ab0a..bd20da0 100644 --- a/nilmdb/utils/mustclose.py +++ b/nilmdb/utils/mustclose.py @@ -38,7 +38,8 @@ def must_close(errorfile = sys.stderr, wrap_verify = False): @wrap_class_method def close(orig, self, *args, **kwargs): - del self._must_close + if "_must_close" in self.__dict__: + del self._must_close return orig(self, *args, **kwargs) # Optionally wrap all other functions