How to stop second guessing yourself on tests?

I have a problem where I change my answer during the last minute. Often, I had the right answer but changed it to a wrong one. How do I avoid this?