docs: def close(self):
          """
          Flush the write buffers of the stream if applicable and
          close the object.
          """
          if self._writable and not self._is_raw_of_buffered and not self._closed:
              self._closed = True
              if self._write_buffer:
                  self.flush()