Plex playback stops 20 seconds or so before end of video

I’m using Plex media server (free version) using my smart tv (Samsung) to view movie files saved on my tv (usually MKV, AVI or MP4). Lately, many of the files are freezing 20 seconds or so before the end of the show and while they will usually rewind a bit, I can never get them to play to the end. I have to watch them on my computer or put them on a USB to watch the endings.

Any ideas?

Wait… You are watching movies stored ON your tv? How did you accomplish that haha. And what Samsung TV do you have