fix crash - writing to closed web socket. closes #176