forgot to close file when reading index