better catching of ws.close message