gdb: fix correct shutdown when using pipes