You might need to call the Wait Until Done function/VI to ensure that the specified operation is complete before you stop the task.
The most common example is a finite generation. If you start a task that performs a finite generation and then immediately stop the task, the generation probably has not completed when you stop the task. As a result, the generation does not complete as expected. To ensure that the finite generation completes as expected, call the Wait Until Done function/VI before stopping the task. After the Wait Until Done function/VI executes, the finite generation has been completed, and you can stop the task.
In general, use the Wait Until Task Done function/VI with finite measurements and generations.