Follow the steps provided by Apple to properly sign out of these accounts and ensure that your personal information is no longer linked to the iMac.