code: def close(self):
          
          if self.__submitted:
              raise ValueError('Cannot close a submitted transfer')
          self.doom()
          self.__initialized = False
          # Break possible external reference cycles
          self.__callback = None
          self.__user_data = None
          # Break libusb_transfer reference cycles
          self.__ctypesCallbackWrapper = None
          # For some reason, overwriting callback is not enough to remove this
          # reference cycle - though sometimes it works:
          #   self -> self.__dict__ -> libusb_transfer -> dict[x] -> dict[x] ->
          #   CThunkObject -> __callbackWrapper -> self
          # So free transfer altogether.
          if self.__transfer is not None:
              self.__libusb_free_transfer(self.__transfer)
              self.__transfer = None
          self.__transfer_buffer = None
          # Break USBDeviceHandle reference cycle
          self.__before_submit = None
          self.__after_completion = None
docs: Break reference cycles to allow instance to be garbage-collected.
          Raises if called on a submitted transfer.