public void CloseSession(ushort statusCode=0, string reason=null) { lock (stateLock) { if (closed) { return; }; closed = true; } try { SendClose(statusCode, reason); } catch { return; } finally { CloseQuiety(); } }