dbquery: fix for teardown appcontext