I thought I had closure until I saw my ex

M
My ex and I broke up almost a year ago and I thought I was finally over him and at peace. However, we have a lot of mutual friends and a lot of my friends work with him at our university. I went into their office to help a friend with something and I saw him. Then I saw him the next day and had a brief but polite hello encounter that I haven't been able to stop thinking about. Why is it that all my hard work putting him and our past out of my head is instantly undone the moment I see him? I'm back to missing him and wishing things could go back to the way they were. I know I wasn't very happy toward the end of our relationship but I keep thinking about all the good times we had. I feel like I will never be able to move on with my life and won't be able to love anyone else because he'll always be there.