tdb/test: add shutdown_agent() helper function