patch 9.0.0460: loop variable can't be found

Problem:    Loop variable can't be found.
Solution:   Adjust block_id of the loop variable each round.
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index fa9bb0c..0f462e3 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -2259,9 +2259,23 @@
 enddef
 
 def Test_for_loop_with_closure()
+  # using the loop variable in a closure results in the last used value
   var lines =<< trim END
       var flist: list<func>
       for i in range(5)
+        flist[i] = () => i
+      endfor
+      for i in range(5)
+        assert_equal(4, flist[i]())
+      endfor
+  END
+  v9.CheckDefAndScriptSuccess(lines)
+
+  # using a local variable set to the loop variable in a closure results in the
+  # value at that moment
+  lines =<< trim END
+      var flist: list<func>
+      for i in range(5)
         var inloop = i
         flist[i] = () => inloop
       endfor