diff --git a/pkg/clientutil/idreply.go b/pkg/clientutil/idreply.go
index 2033c474ee4cfe72cdd19a515deba416600b5eb0..1ff7ecaaadf1b5d62986fa137697f8cb9e504096 100644
--- a/pkg/clientutil/idreply.go
+++ b/pkg/clientutil/idreply.go
@@ -13,7 +13,8 @@ import (
 type IdReply struct {
 	id atomic.Int64
 
-	closed chan struct{}
+	amClosed atomic.Bool
+	closed   chan struct{}
 
 	chs map[string]chan msgOrError
 	mu  sync.Mutex
@@ -108,6 +109,9 @@ func (i *IdReply) Closed() <-chan struct{} {
 }
 
 func (i *IdReply) Close() error {
+	if i.amClosed.Swap(true) {
+		return net.ErrClosed
+	}
 	close(i.closed)
 	return nil
 }