You did the right thing by breaking up with him. It seems that he may have some issues that he needs to work through, and he may or may not be prepared to do that right now.
Meantime, selfish as it sounds, you have to do what's right for
you, not him. Stay away from him for now. You've broken up with him, and he needs to understand that.
Take care.