fixes #5960 - also look at task states to determine completion

sometimes finish_time is not actually set
Merge pull request #4161 from jlsherrill/states

fixes #5960 - also look at task states to determine completion