def METHOD_NAME(self):
    if hasattr(atexit, 'unregister'):
        atexit.unregister(self.close)
    else:
        try:
            atexit._exithandlers.remove((self.close, (), {}))
        except ValueError:
            pass