Finish sorting tasks between pending and completed.