Fix file open mode as text for index generation.