For the index-as-root workaround, at least close the file handle after using it.