Nested loops for repeating blocks?

URL of experiment: https://gitlab.pavlovia.org/haleemer/borrowedds

Description of the problem:
I took the digitspan demo which ends trials after 2 consecutive incorrect answers. However, I wanted this to restart the whole protocol. I put an outer loop around the blocks x 2 so that the experiment would repeat twice. However, the experiment does not proceed as expected. The trials.finished breaks out of all loops and ends the experiment. Would appreciate some advice on how to do three nested loops. Thanks!