@Override
 public void close() {
   if (!closed) {
     try {
       if (index != null) {
         index.close();
       }
     } catch (IOException e) {
       log.error("error closing index", e);
     }
     try {
       file.close();
     } catch (IOException e) {
       log.error("error closing file", e);
     }
     closed = true;
   }
 }
  SimpleStringTermIteratorImpl(
      MapCache mapCache, String filename, String docsFilename, String indexFilename)
      throws IOException {
    buffer = new byte[BUFFER_SIZE];

    this.docsFilename = docsFilename;
    final CachedFile cf = CachedFile.create(indexFilename);
    if (cf.exists()) {
      indexFile = cf.loadDirectory();
    } else {
      indexFile = null;
    }

    file = mapCache.copyOrOpen(filename);
    memory = file.get().memory();
    done = false;
    bufferLen = 0;
    bufferOffset = 0L;
    bufferPtr = 0;
  }