It’s setting trials.finished correctly and it is indeed trying to end the loop using the shared code that ends loops, but it’s breaking when checking whether the results of the loop are empty or not and trying to save it. That’s unexpected.
I’m going to create a copy of your experiment for myself and start tinkering, I’ll update you if I figure something out.