replaced os.linesep with '\n' per docs since we are writing in text mode