Better error handling

When something wrong happens in the process, the act of "close the pipe"
could throw another error, hiding the first one.

We are now eating the error when closing the pipe (we need a log there).