### Preflight Checklist

* [x] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/master/CONTRIBUTING.md) for this project.
* [x] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project adheres to.
* [x] I have searched the issue tracker for an issue that matches the one I want to file, without success.

### Issue Details

* **Electron Version:**
7.1.2
* **Operating System:**
Mac OS 10.15.2
* **Last Known Working Electron version:**
Unknown, bug has existed since at least 4.0

### Expected Behavior
Web workers with node integration should not crash on shutdown.

### Actual Behavior
Web workers with node integration occasionally crash on shutdown.

--




### To Reproduce
I am sorry, I do not have a repro because this is definitely a timing issue and is difficult to track down.
### Additional Information
I would tell you at least what code is involved in the crash, but the library that is the culprit is rather large, we use Monaco Editor, which is a subset of the VScode codebase. When it shuts down webworkers, we occasionally run into this crash.

It looks like there was a similar issue opened https://github.com/electron/electron/issues/11243, but this has been closed and whatever the actual cause of this segfault is still out there, haunting us.

Stack trace, crashes with EXC_BAD_ACCESS / KERN_INVALID_ADDRESS:
```json
{
  "function": "uv_close",
  "function_offset": "0xb7",
  "module_offset": "0x59fa5c7",
  "frame": 0,
  "module": "Electron Framework",
  "registers": {
    "r14": "0x0000000000000000",
    "r15": "0x000000010e29b550",
    "r12": "0x00007f8718515640",
    "r13": "0x000070001c9409b0",
    "r10": "0x000000000000002c",
    "r11": "0x0000000000000206",
    "rsp": "0x000070001c940990",
    "rbx": "0x00007f8717bdda18",
    "r8": "0x000000000001f60b",
    "r9": "0x0000000000000000",
    "rip": "0x0000000113b585c7",
    "rbp": "0x000070001c9409a0",
    "rdx": "0x0000000000000000",
    "rcx": "0x000070001c9409b0",
    "rdi": "0x00007f8717bdda18",
    "rax": "0x000000000000000b",
    "rsi": "0x0000000000000000"
  },
  "file": "/Users/distiller/project/src/out/Default/../../third_party/electron_node/deps/uv/src/unix/core.c",
  "offset": "0x113b585c7",
  "line": 217,
  "trust": "context"
},
{
  "function": "uv_walk",
  "function_offset": "0xaf",
  "module_offset": "0x59f971f",
  "frame": 1,
  "module": "Electron Framework",
  "file": "/Users/distiller/project/src/out/Default/../../third_party/electron_node/deps/uv/src/uv-common.c",
  "offset": "0x113b5771f",
  "line": 456,
  "trust": "frame_pointer"
},
{
  "function": "electron::NodeBindings::~NodeBindings()",
  "function_offset": "0x7c",
  "module_offset": "0x13baec",
  "frame": 2,
  "module": "Electron Framework",
  "file": "/Users/distiller/project/src/out/Default/../../electron/shell/common/node_bindings.cc",
  "offset": "0x10e299aec",
  "line": 104,
  "trust": "frame_pointer"
},
{
  "function": "electron::NodeBindingsMac::~NodeBindingsMac()",
  "function_offset": "0xd",
  "module_offset": "0x13d8ed",
  "frame": 3,
  "module": "Electron Framework",
  "file": "/Users/distiller/project/src/out/Default/../../electron/shell/common/node_bindings_mac.cc",
  "offset": "0x10e29b8ed",
  "line": 20,
  "trust": "frame_pointer"
},
{
  "function": "electron::WebWorkerObserver::ContextWillDestroy(v8::Local<v8::Context>)",
  "function_offset": "0xcb",
  "module_offset": "0x1572bb",
  "frame": 4,
  "module": "Electron Framework",
  "file": "/Users/distiller/project/src/out/Default/../../electron/shell/renderer/web_worker_observer.cc",
  "offset": "0x10e2b52bb",
  "line": 38,
  "trust": "frame_pointer"
},
{
  "function": "blink::WorkerThread::PrepareForShutdownOnWorkerThread()",
  "function_offset": "0xc7",
  "module_offset": "0x4c91b27",
  "frame": 5,
  "module": "Electron Framework",
  "file": "/Users/distiller/project/src/out/Default/./../../third_party/blink/renderer/core/workers/worker_thread.cc",
  "offset": "0x112defb27",
  "line": 668,
  "trust": "frame_pointer"
},
{
  "function": "base::TaskAnnotator::RunTask(char const*, base::PendingTask*)",
  "function_offset": "0x151",
  "module_offset": "0x2361141",
  "frame": 6,
  "module": "Electron Framework",
  "file": "/Users/distiller/project/src/out/Default/../../base/callback.h",
  "offset": "0x1104bf141",
  "line": 98,
  "trust": "frame_pointer"
},
{
  "function": "base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl(base::sequence_manager::LazyNow*, bool*)",
  "function_offset": "0x193",
  "module_offset": "0x23710d3",
  "frame": 7,
  "module": "Electron Framework",
  "file": "/Users/distiller/project/src/out/Default/./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc",
  "offset": "0x1104cf0d3",
  "line": 365,
  "trust": "frame_pointer"
},
{
  "function": "base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoSomeWork()",
  "function_offset": "0x46",
  "module_offset": "0x2370db6",
  "frame": 8,
  "module": "Electron Framework",
  "file": "/Users/distiller/project/src/out/Default/./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc",
  "offset": "0x1104cedb6",
  "line": 219,
  "trust": "frame_pointer"
},
{
  "function": "base::MessagePumpDefault::Run(base::MessagePump::Delegate*)",
  "function_offset": "0x88",
  "module_offset": "0x2326d88",
  "frame": 9,
  "module": "Electron Framework",
  "file": "/Users/distiller/project/src/out/Default/./../../base/message_loop/message_pump_default.cc",
  "offset": "0x110484d88",
  "line": 39,
  "trust": "frame_pointer"
}
```

shell/common/api/electron_bindings.cc
node::Environment* env = node::Environment::GetCurrent(isolate);
  if (std::find(pending_next_ticks_.begin(), pending_next_ticks_.end(), env) !=
      pending_next_ticks_.end())
    return;
  pending_next_ticks_.push_back(env);
  uv_async_send(&call_next_tick_async_);
}
void ElectronBindings::OnCallNextTick(uv_async_t* handle) {
  ElectronBindings* self = static_cast<ElectronBindings*>(handle->data);
  for (std::list<node::Environment*>::const_iterator it =
           self->pending_next_ticks_.begin();
       it != self->pending_next_ticks_.end(); ++it) {
    node::Environment* env = *it;
    gin_helper::Locker locker(env->isolate());
    v8::Context::Scope context_scope(env->context());
    v8::HandleScope handle_scope(env->isolate());
    node::InternalCallbackScope scope(env, v8::Object::New(env->isolate()),
                                      {0, 0},
                                      node::InternalCallbackScope::kNoFlags);
  }
  self->pending_next_ticks_.clear();
}
void ElectronBindings::Log(const base::string16& message) {
  std::cout << message << std::flush;
}
void ElectronBindings::Crash() {
  volatile int* zero = nullptr;
  *zero = 0;
}
void ElectronBindings::Hang() {