Allow to use closure in QueryExpression

Allow to use closure in QueryExpression. Fixes #3852
Should be `function($e) {`.