Write html output in binary mode

JRuby on windows tries to replace all \n with \r\n and does it so poorly that it takes forever to generate the file.
To avoid any kind of interpretation, set the writing mode to wb+ (B meaning binary).
Patch for JRuby/Windows specific to this platform

Extract the fix from previous commit into a function.
Only patch for JRuby/Windows. Maybe MRI/Windows is also affected but we would need more input for that.
Merge pull request #16 from pschambacher/master

Avoid slow file output with JRuby/Windows