How to stop thinking about my ex?

Okay i met sb, everything was perfect first 4 months then he ghosted me for a month, i didn't feel like sad or sth, yes i thought about it first week and then let it go,
Then after a month he came back and like he had a depression whatever, it was wrong from me to give another chance but i did, and he was even better than before romantic caring and all was amazing, after another three months he started to go on an off, and then we stopped talking for a month, I really didn't care i was fine and completely great, i swear i was happy and didn't think about him for over a month.

He came back after that and i told him no i can't take you back i don't want to go through the same shit again, i can't take your ups and downs anymore as i know for sure you will hurt me again, and he simply replied " as you like"

The issue is after i got my closure and ended things between us I can't stop thinking about him, i feel sad and I miss him a lot and wants him back, i really don't know why this is happening right now after i ended everything, it was my choice and i know its correct thing to do, why do i feel bad and guilty like a teenager, is it normal, will it go away or why would this happen
How to stop thinking about my ex?
Post Opinion