Keep STDOUT/STDERR the right mode. Fixes #422

If you reopen STDOUT with an IO object that is "w+", then later reopen
it again as just "w", you get an exception:

`reopen': /dev/null can't change access mode from "w+" to "w" (ArgumentError)
Bump to 2.7.1