(maint) Fix undefined local variable error from afdddb8

Without this patch the acceptance tests fail to run because of an
undefined local variable.  My previous attempt to fix the acceptance
test caused this error because the variable was set inside of a closure
when the variable did not yet exist outside the closure.

This patch addresses the problem by defining the variable outside of the
closure so that the block references our own variable rather than
creating another one.