Proper implementation of archive command, works for done and cancelled tasks (potentially intermixed)