Sorry for the delay; I was away for a few days. It looks like this line of code:

while (vec_dist (plbiped01_entity.x, my.x) > 100) {wait (1);}

isn't working properly; the player might not be able to come closer than 100 quants to the entity that is supposed to trigger the change, so the music can't be faded out (doesn't stop).