What is the best way to ensure one worker does not exit before another?

I have a Head Worker that dynamically calls Worker X and also statically calls Workers Y and Z which need Worker X to function.

Workers X, Y, and Z are one level below the Head worker on the Worker Call-Chain Viewer.

When exit my application I need to ensure that worker X does not exit before workers Y or Z because they have important Public-API tasks to perform before closing.

If I call the Public API cases of Y and Z from the "Start Exiting" case of the Head Worker can I be sure they will complete before Worker X exits OR is there something else I need to do to ensure this?

1 reply