Make sure the exit code is set properly on script errors.