code: public void close() {
          Log.info("Closing index");
          try {
              Log.info("Closing");
              searcherReopener.interrupt();
              searcherManager.close();
              indexWriter.close();
              directory.close();
          } catch (IOException e) {
              Log.error(e, "Error while closing index");
              throw new RuntimeException(e);
          }
      }
docs: Commits all changes to the index, waits for pending merges to complete, and closes all associated resources.