First of all, there seems to be some confusion here. Work permits are issued by the Department of Labour (a government department), and yet you said that it was the immigration department (a branch of the Royal Thai Police) that said you needed to get a cancellation.
This implies that you are currently in Thailand on an extension of stay (on the grounds of employment) rather than on an actual visa. (Just quickly, a visa is permission to enter the country and can only be obtained from outside Thailand. An extension of stay is permission to remain in Thailand, and can only be issued from within Thailand. It is common for people to call both of these a “visa”, and it confuses things.)
Do you also have a reentry permit? This allows you to exit Thailand without immediately cancelling your current permission to stay. If so, is it single-use, or multiple?
The reason I’m asking all these questions is that if you do not have a reentry permit, simply leaving Thailand will cancel your extension of stay. Your work permit will remain valid until its expiry date, but after that it will similarly fall off.
Sadly, there are unscrupulous people in Thailand (agents, “helpers”, even government officers and police) who see foreigners as being extremely wealthy and as a kind of natural resource there to be tapped for money at every opportunity.
For a definitive answer as to what to do in your specific case, I suggest going to the Teaching forum in the forums of thaivisa.com - you are not the first person to be in this exact situation, and as long as you ignore the trolls (for there are many), you should get a definitive answer there. Be sure to include exact details of what sort of visa (and whether it is single- or multiple-entry) that you entered Thailand on, and the exact circumstances of any extensions you have had.
Finally, a word of caution. If you do leave Thailand now, you might find it difficult or impossible to come back if that is your intention, due to visa restrictions during the pandemic. The visa-free entry to Thailand is currently suspended, and Thai embassies and consulates are not issuing visas at the moment.