Did I make the right choice???

Me and my now ex boyfriend dated for about seven months and on the seventh month he told me that he doesn’t like me the same as he used to and that he’s only attached and that maybe he’ll like me again, he said that it’s not a guarantee and that I shouldn’t wait for him. It was like a punch in the heart when he told me that. He said he doesn’t want regrets with me and wants to make me happy but I thought long and hard and saw it time for us to end. He was a really great guy, he was never abusive or demanding, he showered me in gifts and attention, and he always wanted to see me happy. But I’m a person who wants happiness for others too, I told him that he deserves to be happy too- even if that meant us not being together anymore. We ended on good terms and even agreed that we can still be friends (since we were friends for over ten years) but strangely I’m still crying. So did I do the right thing?