Sorry to hear that
I love bettas, it's always extremely saddening to see them die. IMO they have the most personality for any kind of small fish.
It's hard to treat them for anything, they're so damned sensitive to meds sometimes. It sounds like you did your best