sendClose method
Sends a close frame once.
Later calls do nothing.
Implementation
@protected
void sendClose(int? code, String reason) {
if (_closeSent) return;
markCloseSent();
sendFrame(WebSocketOpcode.close, encodeClosePayload(code, reason));
onCloseSent();
}