Generation of closure variables upfront