OCaml backend: better handling of pipes