docs: @Override
      public void close() {
          try {
              if (!hadWriteErrors) {
                  flush();
              } else {
                  if (LOG.isDebugEnabled()) {
                      LOG.debug("Dirty close; ignoring last existing write batch...");
                  }
              }
  
              if (requiresRefreshAfterBulk && executedBulkWrite) {
                  // refresh batch
                  restClient.refresh(resource);
  
                  if (LOG.isDebugEnabled()) {
                      LOG.debug(String.format("Refreshing index [%s]", resource));
                  }
              }
          } finally {
              for (IBulkWriteErrorHandler handler : documentBulkErrorHandlers) {
                  handler.close();
              }
          }
      }