Close the index file between writing and committing