"Invalid movie handle provided" error message

I have a script that just plays videos back to back based off of the “Play Movies Without Gaps” script in PTB’s Movie Demos. I am having a weird issue though where the script consistently picks one movie iteration to quit out of the script midway with an “Invalid movie handle provided” message. Which iteration/movie clip it finds invalid is not consistent. Furthermore, if I take the movie clip and play it through simpleMovieDemo, it plays just fine. In the moment, I can delete the video clip out of the queued clips and then the script will skip it and continue working as normal, but if I reload any of the parameters of the script, it will choose another video handle to quit out over. Again, I’m pretty sure this isn’t an issue with my actual stimuli itself. Does anyone know what it could be?

Ubuntu Linux 22.04
Matlab R2022b
PsychToolBox Version: 3.0.19 - Flavor: Debian package - psychtoolbox-3
Code: playMoviesWithoutGapDemo1.m
Error message: “Invalid movie handle provided”