He may have also been suffering from swim bladder disorder.
I am so sorry for your loss. Just know that you did everything you could, but sometimes bad things happen beyond our control.
If you do decide to get a another betta, there is a lot of information on this site that can help you with that. There is a general betta care thread in the "Betta Care" section. Also check out "Your New Betta" :
Again, I am so sorry about your little guy. Losing a pet is hard, especially one that was so special to you :/