bug fixes: check for support before sending close/ping frames; call on_closed callback even if websocket was not fully open