Avoid setting the stack top below upvalues to be closed

When leaving a scope, the new stack top should be set only after
closing any upvalue, to avoid manipulating values in an "invalid"
part of the stack.
3 files changed