dup2 STD*_FILE instead close to avoid SIGPIPE under linux