synchronize quit and slave routine