Container shutdown order

When a stack service is deployed container startup is observed. However, when it is stopped it appears that everything is given the shutdown order at once. This can be problematic if containers depend on each other and the dependent happens to shutdown first. I know about the docker-compose depends_on, but the docs only mention start/up events and not stop/down. Is there a way to better control the container shutdown processes so that containers full wait for their dependent container to stop before they shutdown?

Thanks!