[FIX] XQuery, promote closure type. Fixes #1023