Fixes stream unregistration in OgHttp2Session::CloseStream().

Streams should be unregistered from the write scheduler when closed. In practice, the only likely effect is an attempt to call Send() that won't end up sending anything, because the stream is gone.

PiperOrigin-RevId: 409516016
diff --git a/http2/adapter/oghttp2_session.cc b/http2/adapter/oghttp2_session.cc
index d398b1b..34d8711 100644
--- a/http2/adapter/oghttp2_session.cc
+++ b/http2/adapter/oghttp2_session.cc
@@ -815,7 +815,6 @@
   if (iter != stream_map_.end()) {
     iter->second.half_closed_remote = true;
     iter->second.outbound_body = nullptr;
-    write_scheduler_.UnregisterStream(stream_id);
   } else if (static_cast<Http2StreamId>(stream_id) >
              highest_processed_stream_id_) {
     // Receiving RST_STREAM before HEADERS is a connection error.
@@ -1134,6 +1133,9 @@
                                  Http2ErrorCode error_code) {
   visitor_.OnCloseStream(stream_id, error_code);
   stream_map_.erase(stream_id);
+  if (write_scheduler_.StreamRegistered(stream_id)) {
+    write_scheduler_.UnregisterStream(stream_id);
+  }
 
   if (!pending_streams_.empty() && CanCreateStream()) {
     PendingStreamState& pending_stream = pending_streams_.front();