Refactor to use dispatch_io for tasks, and wait for EOF

Hopefully resolves #139, #135, #161.

/cc @joshaber @keithduncan
![](http://replygif.net/i/1261.gif)

I'ma just leave this as-is.