If you intend to write more events to this (dont know if thats gonna be the case), that wait will bring you hopeless problems.
Besides that.
Use Browser plugin to log Sprite.UID&"/"&loop&"**"&Pico to the console in your last loop.
'loop' in there is a global variable you add 1 to in that last event.
Watch it run in Chrome's console.
At any iteration you (mostly) write a bigger number on a 'next' index in the array. It rarely resets.
So next iteration, when that next index is used, pico grows according, and keeps growing.
When the sprite 50 is picked, it allready does like 120.000 iterations. At that moment you write the same value on the same place in the array like 3000 times.
It is freezing because you created a near endless loop.