Two thoughts on possible causes:
1. I have a Baby Lock Soprano. Certain stitches have automatic tie-off stitches at the beginning, end, or both. While certainly not 25 stitches, this could account for a few stitches at the end.
2. Sometimes my foot pedal will scoot around and get caught underneath the rug or the edge of furniture that will hold the pedal down. You've probably checked for this, I know!
Good luck and let us know what happens!