Every rider, I don't care how good you are, has experiences that cause the heart to jump into the throat! Take this as what it is - a bad spook - and you stayed on and you did well.
Confidence will come with more experience, but for now, just get back up there even if you are very nervous, just do it and you will have a great ride and feel ok again. It goes up and down like a roller coaster sometimes with these guys!!
IF you have more bad rides than good ones, consider a different horse. It's not failure to say you've made a mistake and it's not worth it to keep going on with a horse and hating every ride
Just see what comes of it, don't put too much pressure on yourself and have fun.