private void flushCloseAndValidate(Log log) throws IOException {
    // flush should not throw any exceptions
    log.flush();
    // close log and ensure segments are closed
    log.close(false);
    LogSegment segment = log.getFirstSegment();
    while (segment != null) {
      assertFalse("LogSegment has not been closed", segment.getView().getSecond().isOpen());
      segment = log.getNextSegment(segment);
    }
  }
Flushes and closes the log and validates that the log has been correctly closed.
@param log the {@link Log} intance to flush and close.
@throws IOException
ambry-store/src/test/java/com/github/ambry/store/LogTest.java