Don't generate .mem file.
Wrap the generate code in a closure.