common: Make sure to get all data out of CockpitPipe

When a process exited before all its data had been received,
we would accidentally lose the last bit of data. Wait until the output
has closed before closing the pipe.

Closes #849
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>