GenerateIndex: work with temp files and only commit after successful update of indexes.