--- a/eric6/DocumentationTools/IndexGenerator.py Tue Oct 13 19:02:26 2020 +0200 +++ b/eric6/DocumentationTools/IndexGenerator.py Wed Oct 14 17:50:39 2020 +0200 @@ -180,9 +180,8 @@ ) + self.footerTemplate ) - f = open(filename, "w", encoding="utf-8", newline=newline) - f.write(doc) - f.close() + with open(filename, "w", encoding="utf-8", newline=newline) as f: + f.write(doc) return filename