Slammed the door on him

Whenever things don't go his way, he's ready to walk away and I end up practically begging him to stay and talk things out. When I don't, he makes it my fault like I don't care about him. ??? Well today I felt he should fight for me instead of me always doing the work. I'm emotionally drained and overwhelmed with life at the moment. I tried to open up to him about these things over the weekend and he begin yelling at me and telling me how annoying I was and how he doesn't want to hear about that shit. So I made up in my mind to keep things to myself. Fast forward to now, I was a bit quiet and sad because it's one thing after the other and I don't feel I can talk to him. So I feel alone. I assured him he wasn't the problem but I told him I didn't want to talk about it. His response was to leave. As he's walking to the door, He asked what he did that I can't talk to him... I had NO PROBLEM with him today until he decided to just up and leave. I no longer wanted to hear what he had to say after he was walking out the door saying nobody wants to be around depressed shit so I said "well don't be around it" and slammed the door on him as he was talking.. I honestly just wanted there to be a time that he could be there for me. Hold me or something and show me that he's by my side. Not just leaving every time things don't go his way. And I hate feeling I can't open up to him anymore when he's supposed to be my best friend. Together 3 years and things seem so confusing now.