use callback in cmdpipe also when the connection is closed
use that.