Fix hang on terminate when inproc is connected but never bound

Backported fix for #888