I have done this process at Chiang Mai a few years ago, so it can be done, but it is possible that they will initially say that you can't change the reason for extension from ED to Retirement (I was told I would have to leave Thailand and get a new visa, which I refused to accept as valid), in which case, just ask to speak to a more senior officer (possibly, it isn't a common procedure, but it is very straightforward in fact). Do make sure that you have a letter from your school confirming that you want to cancel your ED as
@Tod ********
has said and then it's a straightforward process.