Fixes a bug in the capture of nested closures

Could such as the following would fail:

    function nested_closures = {
      let s = "plop"
      let f1 = |x| -> x
      let f2 = {
        return {
          return f1(s)
        }
      }
      return f2()
    }

The call to f1 in the definition of f2 would be interpreted as a regular call to some function f1
rather than a call on the closure assigned to reference f1. The call to f2 was correct, though.

The fix involved some more work on the closure capture visitor on the intermediate representation.