Some other fixes for Windows.

Hello Ken,

This pull request fixed bugs on Windows due to stdin and stdout opened in text mode instead of binary mode. Also fixed wrong type of data for file descriptor selection (was dictionary instead of tuple, sorry for that).

See comments in code for more info.

Cheers,
syl20bnr