Fix TaskChain job splitting when KeepOutput used

add Seangchans fix as well
Merge pull request #5458 from amaltaro/reallyFix-keepOutput

Fix TaskChain job splitting when KeepOutput used