When should you intervene when user testing?

If the participant fails the task set in user testing and clicks on the wrong sections, when is a good time to ask questions regarding why they clicked on those wrong sections? Is it better to ask before moving onto the next task so it is fresh in their minds or at the end of the testing when they have completed all the tasks?