code: def close(self):
          '''Closes the underlying writer, flushing any pending writes first.'''
          if not self._closed:
              with self._lock:
                  if not self._closed:
                      self._closed = True
                      self._worker.stop()
                      self._writer.flush()
                      self._writer.close(f close(self):
          '''Closes the underlying writer, flushing any pending writes first.'''
          if not self._closed:
              with self._lock:
                  if not self._closed:
                      self._closed = True
                      self._worker.stop()
                      self._writer.flush()
                      self._writer.close()
docs: Closes the underlying writer, flushing any pending writes first.