I had a few POP / POP3 accounts that I was unable to remove. I think this will also apply to IMAP accounts. No matter what I did, there were no errors and no removals of accounts. This happened after I upgraded from Sierra to High Sierra. You need to do this if you want to upgrade POP accounts to IMAP accounts (all existing emails will be deleted, so archive them first).
Go to UserName\Libraries\Mail (google on how to show libraries and user name in finder). Check if there are 2 Vx-folders. I had V2 and V5. V2 was completely empty except for a file called MailData\Accounts.plist I renamed V2 to V2.corrupt and started Mail once more. This time I could remove my accounts no problem (adding them back as IMAP still failed; I had to go to the general Settings - Accounts to remove them; once they were removed there too, everything was as expected).
Freaking Apple... Using 2 Mail folders simultaneously! Shame!!
;p Devvie