Actually honor passed-in mode for IO#reopen. Porting oops.

This commit also makes the spec run better in MRI...using full
path in the temp file name caused it to exceed maximum path length
in MRI.
Fix spec to pass under MRI 2.1, which also makes it pass in JRuby.
Simplify "lost ivar writes" spec to be simpler, more reliable.