Pain during sex

So recently during sex I would feel an incredible amount of pain as if I was rubbing my vagina against sand paper

I just ignored it because of the heat of the moment. But then came the next time my partner and I had sex, and it felt as if the opening of my vagina had literally closed.

Has anybody else gone through this? or even knows why this happens