If WMP is freezing, it's often an issue with video codecs/splitters, sometimes triggered by specific files that cause them to crash. Updating or finding alternatives for those components can fix things sometimes.
Have you manually installed any codecs or codec packs?
There's an alternative way to use WMP which may be more stable on your system. Try the steps shown in the Windows Media Player (Preview Handler) section of Viewer pane: Turn off auto-play for video and audio to see if that's more stable.
(Check that video playback is working OK in File Explorer's viewer pane as well, since this makes Opus try the same component File Explorer uses.)
Does this only happen when changing from a video to something else?
You mentioned above it also happened when moving through JPEG images. Or are there also some videos in that folder?
If it happens with just JPEGs, could you send us a dump of that?