Write correct process output in case it terminates with an error.