Well, I guess while you are playing your video, you have a loop like this:

while(media_playing(yourhandle)) wait(1);

If you use media_stop, it should also cancel your loop.