When pegasus-plan fails with a fata error the exit code remains 0 as the exit code is from the tee command.

Adding set -o pipefail so a non-zero exit code is returned when any of the commands in a pipe fail.