Closures inside loops

Explanation of the problem of closures inside loops and how to fix it