After returning from a function, remove all the scopes that were creating during the function call and aren't referenced by the return value.
After returning from a function, remove all the scopes that were creating during the function call and aren't referenced by the return value.