@Avi *********
Yes, you understand correctly,
GO get the stamps moved to the new passport then get the document from your school and cancel the extension about a week before it expires
First off we need to know if you're on the original 90 day entry from the ED visa or if you extended it at the immigration office and have a stamp that says "extension of stay permitted until" and has a date..
If you have an extension stamping out of the country on an extension does NOT cancel it, you have to physically go to the immigration office with documentation from the school to get it cancelled.
Get a letter from your school saying you stop studying on the day your current stamp runs out, go to the office about a week before that, they'll cancel the extension, and stamp you in until the date on the paperwork THEN you can leave thailand without an issue down the road.
Even though you're leaving by air believe it or not some land borders won't even let you OUT of the country on an "open" extension based on education.