Patch submitted by nix8 to close pipe