+1 on the above. Something else, though - I think a good thing to take away from this experience is the understanding that every time you get on the horse, it's a fresh ride. Even if you've never had problems with the horse before, it's always possible that they're going to do something unexpected, so as riders, we have to be ready to deal with things on very short notice.
Even the most bomb-proof horse will still spook and rocket away if a bee stings it in the butt.
Even the most deadened trail horse for hire can still spook if a deer jumps out at it from a clump of trees.
We have to be prepared for all kinds of things.
I think you were quite right to cut things short - it's best to end on a good note (because then you don't have the blow to the confidence) but it's better to stop on a not-so-good-note if the only realistic alternative is to carry on and get super-frustrated.
You didn't really ask for this, but I'm going to give you some advice anyway, and this comes from my experience as an adult learning. When horses are known to have some kind of aberrant behavior (Stupid Lesson Horse Tricks, leaning on the leg, pulling at the reins, or in your case, this spinning) it's because the horse does this kind of thing on a regular basis. It's a habit. Horse will try it, and if it gets away with it once with you, it's going to try it again and again and again.
This can be frustrating, but it's more useful to think of it as a learning opportunity...because all horses do this kind of thing from time to time, so if you keep riding, you're going to have to deal with it.
Here's the good news. With this kind of habitual behavior, it's my (somewhat limited) experience that it doesn't usually come out of nowhere. That is, the horse provides some kind of "sign" that it's going to happen soon. As an example, I've been riding this lesson horse all winter that is VERY lazy, and will drop out of a trot or canter to a stand-still any time it can. BUT before he does that, he starts hanging his head and pulling on the reins. AND if I pay attention to the weight of his head in my hands, and give him a good boot the *instant* he starts to hang his head, I can keep him trotting or cantering. If I don't, he'll do it, and then he'll try it again and again and again and again. It makes me attend much more closely to his head position than I have to do with my horse, who does not have this trick (he has other tricks).
Point is, this horse probably has some kind of sign that precedes her spinning misbehavior, and your trainer - if s/he works often with the horse - probably knows what that sign is. You should talk to the trainer to find out if this is the case...and if so, what your trainer thinks you should do at the first sign of the problem. It's much better not to let her even get started with it than to try to fix it once it's started.
But, again, even if you get this spinning thing sorted, or if you ride a different horse, you're still going to have to deal with this kind of issue (horse doing something undesirable). Think of it as improving your horsemanship skills!