don't use text mode in mkstemp

causes double-encoding of newlines, preventing newline arg from having desired effect,
and resulting in CRCRLF line endings on Windows.

closes #6599