Stop all GenStage process after the finite stage finish processing events

I have a finite stage that I want to start using an HTTP endpoint. All the GenStages in the pipeline are started by a Supervisor in the endpoint.

What I don’t know is how to execute a gracefully shutdown of all the GenSages after all the events are processed.
I was trying to use a combination of

    GenStage.sync_info(genstager_pid, :empty)

and track when all the stages have no buffered events. But I wasn’t able to know exactly when everything is done processing.

Hope, you can share some ideas.