Attempt to close index files properly.