Remove finished tasks to allow garbage collection.