only wrap captured variables that are actually changed in or after closure (closes #3548)