Guard data.prev from being null propagating Java excps from Fiber.
Partial re-port of reopen to handle modes better. Fixes #1104.

This is only a partial re-port of MRI reopen logic, but it does
a better job of propagating the incoming IO's modes to the new
stream/descriptor under the covers. The cases given in the bug now
pass and I will try to come up with a good test case for them.