small improvement: cache closures that have no free vars