Added better support for very large files (> 4GB), further reopening of stdin/stdout as binary streams under windows