[Process] Close unix pipes before calling `proc_close` to avoid a deadlock

see http://php.net/manual/en/function.proc-close.php