Added support for %closure-ref to code generation