Close stdin/out/err before forking.

This ensures that if the parent shell exits, the tty can be closed (e.g.
when running in screen the window will close automatically instead of
waiting for all forked rmate processes to exit).
Merge pull request #12 from tornewuff/detach_better

Close stdin/out/err before forking.