Handle asynchronous and old finished tasks at shutdown (passes tests).