code: func (ix *IndexWriter) Flush() {
  	ix.addName("")
  
  	var off [5]uint32
  	ix.main.writeString(magic)
  	off[0] = ix.main.offset()
  	for _, p := range ix.paths {
  		ix.main.writeString(p)
  		ix.main.writeString("\x00")
  	}
  	ix.main.writeString("\x00")
  	off[1] = ix.main.offset()
  	copyFile(ix.main, ix.nameData)
  	off[2] = ix.main.offset()
  	ix.mergePost(ix.main)
  	off[3] = ix.main.offset()
  	copyFile(ix.main, ix.nameIndex)
  	off[4] = ix.main.offset()
  	copyFile(ix.main, ix.postIndex)
  	for _, v := range off {
  		ix.main.writeUint32(v)
  	}
  	ix.main.writeString(trailerMagic)
  
  	os.Remove(ix.nameData.name)
  	for _, f := range ix.postFile {
  		os.Remove(f.Name())
  	}
  	os.Remove(ix.nameIndex.name)
  	os.Remove(ix.postIndex.name)
  
  	log.Printf("%d data bytes, %d index bytes", ix.totalBytes, ix.main.offset())
  
  	ix.main.flush()
  }
docs: // Flush flushes the index entry to the target file.