Mkvmerge continually getting hung when applying timecodes

I am using mkvmerge to apply timecodes to a video file. Basically what I’m doing is removing duplicate frames in a recording to get to native 23.976 fps by generating a list of frames and timecodes (with ffprobe), selecting the frames using Vapoursynth, and then applying the timecodes with mkvmerge. The command I’m using is mkvmerge --timecodes 0:corrected_timecodes.txt -o corrected_vfr.mkv vfr_video.mp4 audio.m4a. The Vapoursynth command I’m using is vspipe -c y4m process.vpy - | ffmpeg -f yuv4mpegpipe -r 24 -i - -c:v libx265 -preset fast -crf 0 -colorspace bt709 -color_trc bt709 -color_primaries bt709 “D:\video_only.mkv”.

Now I have tried this without the color primary tags with Vapoursynth and I got to exactly 56% before it just hung maxing out a CPU thread. Now with the new file I’ve made it gets hung at 1%, despite playing perfectly in VLC and opened in avidemux with no errors. I’ve also tried without muxing in the audio (just video) and no change. ffmpeg -v error shows no issues with the video. I can’t find any way to print debug info to show what it’s getting stuck on and there don’t appear to be any logs.

I have used mkvmerge tons of times before to apply timecodes with zero issues, but this is the first time I’ve done it in combination with Vapoursynth. The thing is I’ve played through the exact spot where it gets hung with no issues with VLC so I don’t understand why mkvmerge is acting up. And I’ve confirmed my timecodes file has exactly the same number of frames as the video. So I don’t understand why it just gets stuck.

I’m happy to provide any info you need or run any tests, and any help would be appreciated!

Edit: I do want to add that this is not random, it happens at the exact same spot every time I run it, so I don’t think it’s a hardware error.