WriteIndexFile method