Fixes FUNCTION and CLOSURE when /local not last refinement

Fixes http://issue.cc/r3/2109
Merge pull request #186 from BrianHawley/fix-2109-function-local-not-at-end

Fixes FUNCTION and CLOSURE when /local not last refinement