private void handleArchiverException(GemFireException ex) {
    if (archiver.getSampleCount() > 0) {
      StringWriter sw = new StringWriter();
      ex.printStackTrace(new PrintWriter(sw, true));
      logger.warn(LogMarker.STATISTICS_MARKER, "Statistic archiver shutting down because: {}", sw);
    }
    try {
      archiver.close();
    } catch (GemFireException e) {
      if (archiver.getSampleCount() > 0) {
        logger.warn(LogMarker.STATISTICS_MARKER, "Statistic archiver shutdown failed because: {}",
            e.getMessage());
      }
    }
    if (archiver.getSampleCount() == 0 && archiveId != -1) {
      // dec since we didn't use the file and close deleted it.
      archiveId--;
    }
    archiver = null;
  }
Closes any {@link StatArchiveWriter} currently in use by this handler.
geode-core/src/main/java/org/apache/geode/internal/statistics/StatArchiveHandler.java