WARNING: Long post
This definitely has to do with mindset. However, there's a million different suggestions on how to deal with mindset, and only a few of them will help you, so I'm going to try and explain what your mindset does to your playing. Then you can recognize what's happening in your head, and what problems it's causing.
From what I've seen, mindset has a few big impacts when you're about to win. It depends on who you are, and what your situation is. I can think of about four main issues with mentality near the end of a game -- try and figure out which one fits you (anyone can add to this list, btw, it's not complete and only based off of my experience and knowledge).
1. Fear of your choices
When you get nervous at the end of a game, even if you don't feel nervous exactly, a lot of people become scared of everything they do. M2K (especially in the past) is a huge example of this. When you play, you end up sticking to a few habits that are 'supposed to work,' and you don't go for almost any reads because you're scared you'll be wrong. There's a few reasons this messes you up... it makes your really predictable, for one. Another reason is that you have a lot more going on in your head -- He's going to roll to the right, you think, but you become scared that, if he doesn't roll to the right, you'll get punished. Because you went through that whole thought process, you lost valuable time and hurt your chances of winning.
2. Deer in Headlights
Maybe this is "Fear of your choices" to an extreme, maybe it's something completely different. Either way, this is essentially where you freeze up. This used to be my issue -- my head stopped, and I felt helpless. It wasn't that I didn't trust my choices. I just couldn't think of anything to do. It's pretty hard to miss when you fall into "Deer in Headlights." You'll notice a lot of new players having this issue, because they don't have options ingrained into them like a lot of people who've been playing for a while. Usually these people end up trying to run away a lot, and never throw out an attack unless they're panicked.
3. Cocky
Other people get cocky if they start out their game really well. Think of this as the opposite of "Fear of your choices" -- you start to go for a fox Usmash every time you get a read, for instance, or you try and waveshine a peach even though you've never practiced consistent waveshining. While it's good to be confident in your reads, this mindset screws you over. Chances are, you'll make a few mistakes, and get punished for them. A lot of times, when you get punished really hard, your cockiness disappears immediately, and is replaced with something else -- maybe "Fear of your choices," maybe something else, but usually nothing good.
4. Overexcited
There's nothing wrong with being excited when you're close to the end of a match. Of course you will be! The issue is that many people let it impact their decisions. When people get overexcited, they tend to rush into decisions before they understand the situation. It sometimes looks like a cocky player, but there's a big difference. A cocky player thinks they can't be beaten, an overexcited player hardly thinks at all. Usually, these people will try to make hard reads when they don't have a read, or only approach and not mix it up, because they're SO CLOSE.
Try and figure out if you have one (or more) of these four issues, or maybe a different issue in your mindset that I didn't mention. The key to improvement is recognizing what the issue is.
Sorry if this post was too long, haha ;;o,o I kind of got carried away. Hope it helps!