I think it was pretty obvious that conditions weren't going to change for the better. So... you did the right thing.
Here's what is really important now - not dwelling on the past and even more important, not coming down on yourself. I'm sure you tried very hard to make it work out. Give yourself some credit.
What you have to do now is think what else you can change to have a happier future.
I had to learn that the hard way. After a very difficult time, I had to set some goals for my future. It was not an easy thing to do. It was far easier to be angry and hurt. Trouble was, that didn't make anything better. And it kept me from moving forward.
So now, the questions for you are: What would you like to have in your life? Then... What type of person do you have to become to have that? What new attitudes? What new skills? I know it's not easy to think in those terms. Change is never easy. But it's necessary. And well worth it when we do it.
Your child will learn that when things aren't right he'll need to make some tough decisions.
Life would have been better for all of us, I think, if we would have learned that at a younger age (I'm 56). I grew up thinking things would be easy. Life isn't easy. It's tough for everyone. That's why we need to become smarter, stronger, and more skillful as we go through life.