<!-- If you need to report a security issue please visit https://github.com/apache/dubbo/security/policy -->

- [x] I have searched the [issues](https://github.com/apache/dubbo/issues) of this repository and believe that this is not a duplicate.

### Environment

* Dubbo version: 3.0.5-SNAPSHOT

### Steps to reproduce this issue

1. Start provider and consumer use `triple` protocol.
2. Consumer invoke timeout interface.
3. Provider throw `ClosedChannelException`
```
java.nio.channels.ClosedChannelException
	at io.netty.handler.codec.http2.AbstractHttp2StreamChannel$Http2ChannelUnsafe.write(AbstractHttp2StreamChannel.java:916)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.write(DefaultChannelPipeline.java:1367)
	at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717)
	at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:709)
	at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:792)
	at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:702)
	at io.netty.channel.DefaultChannelPipeline.write(DefaultChannelPipeline.java:1015)
	at io.netty.handler.codec.http2.AbstractHttp2StreamChannel.write(AbstractHttp2StreamChannel.java:480)
	at org.apache.dubbo.rpc.protocol.tri.command.QueuedCommand$AbstractQueuedCommand.run(QueuedCommand.java:56)
	at org.apache.dubbo.rpc.protocol.tri.WriteQueue.flush(WriteQueue.java:67)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute$$$capture(AbstractEventExecutor.java:164)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.lang.Thread.run(Thread.java:748)
[WARN][2021-12-22 15:40:12.099][NettyServerWorker-3-1][org.apache.dubbo.rpc.protocol.tri.ServerOutboundTransportObserver.lambda$onMetadata$0(ServerOutboundTransportObserver.java:42)ogger{50}]  [DUBBO] send header error endStream=true, dubbo version: 3.0.5-SNAPSHOT, current host: 10.128.49.130
```
4. When invoke timeout client will close channel.
https://github.com/apache/dubbo/blob/0765b612cb89fa22a40c3043e955552c8e941160/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleClientRequestHandler.java#L57-L58

Pls. provide [GitHub address] to reproduce this issue.

### Expected Behavior

<!-- What do you expect from the above steps？-->

### Actual Behavior

<!-- What actually happens? -->

If there is an exception, please attach the exception trace:

```
Just put your stack trace here!
```

}
        ArgumentCaptor<QueuedCommand> commandArgumentCaptor = ArgumentCaptor.forClass(QueuedCommand.class);
        ArgumentCaptor<ChannelPromise> promiseArgumentCaptor = ArgumentCaptor.forClass(ChannelPromise.class);
        Mockito.verify(channel, Mockito.times(5)).write(commandArgumentCaptor.capture(), promiseArgumentCaptor.capture());
        List<QueuedCommand> queuedCommands = commandArgumentCaptor.getAllValues();
        Assertions.assertEquals(queuedCommands.size(), 5);
        Assertions.assertTrue(queuedCommands.get(0) instanceof HeaderQueueCommand);
        Assertions.assertTrue(queuedCommands.get(1) instanceof DataQueueCommand);
        Assertions.assertTrue(queuedCommands.get(2) instanceof CancelQueueCommand);
        Assertions.assertTrue(queuedCommands.get(3) instanceof TextDataQueueCommand);
        Assertions.assertTrue(queuedCommands.get(4) instanceof FlushQueueCommand);
        Mockito.verify(channel, Mockito.times(1)).flush();
    }
    @Test
    public void testChunk() throws Exception {
        WriteQueue writeQueue = new WriteQueue(channel);
        
        writeMethodCalledTimes.set(0);
        for (int i = 0; i < DEQUE_CHUNK_SIZE; i++) {
            writeQueue.enqueue(HeaderQueueCommand.createHeaders(new DefaultMetadata()), false);
        }
        writeQueue.enqueue(HeaderQueueCommand.createHeaders(new DefaultMetadata()), true);
        while (writeMethodCalledTimes.get() != (DEQUE_CHUNK_SIZE + 1)) {
            Thread.sleep(50);
        }
        Mockito.verify(channel, Mockito.times(DEQUE_CHUNK_SIZE + 1)).write(Mockito.any(), Mockito.any());
        Mockito.verify(channel, Mockito.times(2)).flush();
    }
}