diff --git a/src/handle_wrap.cc b/src/handle_wrap.cc index 69e2a389f9e148..17728380082220 100644 --- a/src/handle_wrap.cc +++ b/src/handle_wrap.cc @@ -148,7 +148,8 @@ void HandleWrap::OnClose(uv_handle_t* handle) { wrap->OnClose(); wrap->handle_wrap_queue_.Remove(); - if (!wrap->persistent().IsEmpty() && + if (!env->isolate()->IsExecutionTerminating() && + !wrap->persistent().IsEmpty() && wrap->object()->Has(env->context(), env->handle_onclose_symbol()) .FromMaybe(false)) { wrap->MakeCallback(env->handle_onclose_symbol(), 0, nullptr);