Unable to execute MoviePipelineQueue from Python

I have not had much luck when executing from the command line.

UE4Editor-Cmd.exe "%cd%/MyProject.uproject" -ExecutePythonScript="%cd%/Python/test_render.py"

The problem is that the python script finishes immediately after launching the queue. Then the editor just exits without waiting for queue to finish. Any attempt to stall in the python script just hangs the editor.

I cannot figure out how to make the editor stay open and wait on the finish callback.

As a workaround, I was planning to add the movie script as a startup script for the editor and then make the editor exit when the finish callback is called. (unreal.SystemLibrary.quit_editor())