Improve crab purge, for issue #4101

Only allow task that is in status killed, failed , finished or killfailed to be purge