writing the indexes to the disc