Close outgoing ws if incoming ws emits error

Fixes #559, which contains a full reproduction recipe.