Generate proper line endings on Windows

This is an attempt to fix the problem reported by @bentrm in #1747.