code: def close(self):
          
          if self._mode.find('w') >= 0:
              self._queue.put(self._sentinel)
              self._thread.join(timeout=self._timeout)
              if self._thread.is_alive():
                  raise RemoteFileException("Closing file timed out.")
              response = self._response_queue.get_nowait()
              try:
                  response.raise_for_status()
              except Exception as e:
                  raise RestApiError(cause=e)
          else:
              self._read_response = None
docs: in write mode, closing the handle adds the sentinel value into the
          queue and joins the thread executing the HTTP request.  in read mode,
          this clears out the read response object so there are no references
          to it, and the resources can be reclaimed.