Fix async protocol handler

We need to maintain a reference to the input stream or else it gets
garbage collected and closed. Easiest way is just to reference it from
the closure passed to asyncWait.