Emotionally guarded

My husband hurt me a lot over the duration of our marriage. I’ve gotten comments from him saying I’m shut off, I’m emotionally distant, I’m cold stuff like that. It hurts but I don’t feel safe around him. I can’t depend on him. I’ve tried therapy but I have PTSD and other mental illnesses that they’re saying affects the way I function. But I noticed that I am completely opposite with my kids. I give them my everything and I provide a secure attachment for them. My husband hates that and says I baby them and I do the most but I love my kids to death. So is the problem him or do you think I could be like this to any future partners? I know I’m capable of having close relationships and bonds and trust but I don’t think I can with my husband.