Otsukaresama deshita. Osaki ni shitsurei shimasu. Thank you for your hard work. Excuse me for leaving before you. A manners column on All About calls this the standard, safe phrase for leaving work before others. It suggests also asking whether there is anything to help with.
In the tea ceremony, guests also say osaki ni, before you, and dōzo, please go ahead, to one another before drinking.