code: @Override
    public void close() throws IOException {
      final MapAppender appender = mapAppender;
      if (appender != null) {
        appender.close();
      }
      mapAppender = null;
  
      recordCache = null;
    }
docs: Closes underlying output stream and writes nulls to all the internal fields.
  No metrics should be written from any other thread when this object is closed.
  
  @throws IOException On I/O error when closing output stream
  {@inheritDoc}