Finalize task.