Do not use os.linesep when writing to a file opened in text mode