Leg pain when finishing

I’ve noticed that when I orgasm my legs hurt like cramps, my legs arnt tense or anything but it still hurts and it throws me off and takes a minute for me to ignore it and finish. Is there a way to make it not do that? It doesn’t matter what position I’m in either