io: fix filedescriptor leak on FreeBSD/OSX
io: implement io.lines() and lines() methods
io: handle standard streams better

Bash gets confused by non-blocking stdin,
so set standard streams to non-blocking
on __gc.

FreeBSD errors when trying to set stdout
non-blocking when it is redirected to /dev/null.
So just silently ignore such errors.