code: def close(self):
          
          self.flush()
          if self._recordio_writer is not None:
              self._recordio_writer.close()
              self._recordio_writer = None
docs: Flushes the pending events and closes the writer after it is done.