Use os.linesep as default line ending

On Windows, the default line ending should be '\r\n' instead of '\n'.