diff --git a/piker/clearing/_paper_engine.py b/piker/clearing/_paper_engine.py index e669fd42..788e7674 100644 --- a/piker/clearing/_paper_engine.py +++ b/piker/clearing/_paper_engine.py @@ -460,4 +460,10 @@ async def open_paperboi( loglevel=loglevel, ) as (ctx, first): - yield ctx, first + try: + yield ctx, first + + finally: + # be sure to tear down the paper service on exit + with trio.CancelScope(shield=True): + await portal.cancel_actor()