Retain reference to lambda to prevent it from being gc'd early

If the refcount of a lambda goes to 0 from within the event loop, it tries to
garbage collect it from within the zend engine. However, this breaks if that
lambda is on the call stack.

To prevent this condition, the lambda must hold a reference to itself until
it exits, at which point the refcount goes to 0 and it can be naturally
garbage collected.