Added Index#write and Index#write_tree