Procedure fails unexpectedly depending on trigger

I have a procedure that displays a text list object based on a variable. The procedure that generates the contents of the variable is triggered with either a button on the form or when terminating a text edit object.

The procedure ran fine when triggered by a button.
The exact same procedure would not run when triggered by terminating editing of the TEO. The procedure failed in the middle of the procedure and gave an error message that a certain variable does not exist when it does exist.

Both the Button and the TEO reside in a TabPanel Object.

I was able to make the procedure run perfectly when triggered by terminating editing of the TEO by added a CloseActiveObject statement at the beginning of the procedure. I am wondering if we need to add a CloseActiveObject statement at the beginning of a procedure that will be triggered by terminating edit of a TEO?