Fix use-after-free error in EV_CLOSURE_EVENT callback