code: def close(self):
          
          handle = self.__handle
          if handle is None:
              return
          # Build a strong set from weak self.__transfer_set so we can doom
          # and close all contained transfers.
          # Because of backward compatibility, self.__transfer_set might be a
          # wrapper around WeakKeyDictionary. As it might be modified by gc,
          # we must pop until there is not key left instead of iterating over
          # it.
          weak_transfer_set = self.__transfer_set
          transfer_set = self.__set()
          while True:
              try:
                  transfer = weak_transfer_set.pop()
              except self.__KeyError:
                  break
              transfer_set.add(transfer)
              transfer.doom()
          inflight = self.__inflight
          for transfer in inflight:
              try:
                  transfer.cancel()
              except (self.__USBErrorNotFound, self.__USBErrorNoDevice):
                  pass
          while inflight:
              try:
                  self.__context.handleEvents()
              except self.__USBErrorInterrupted:
                  pass
          for transfer in transfer_set:
              transfer.close()
          self.__libusb_close(handle)
          self.__handle = None
docs: Close this handle. If not called explicitely, will be called by
          destructor.
  
          This method cancels any in-flight transfer when it is called. As
          cancellation is not immediate, this method needs to let libusb handle
          events until transfers are actually cancelled.
          In multi-threaded programs, this can lead to stalls. To avoid this,
          do not close nor let GC collect a USBDeviceHandle which has in-flight
          transfers.