function terminateWorker(workerId) {
  // Unregister all modules that were registered in that worker
  if (registeredModules[workerId]) {
    registeredModules[workerId].forEach(unregister => {
      unregister()
    })
  }
  // Terminate the Worker object
  if (workers[workerId]) {
    workers[workerId].terminate()
    delete workers[workerId]
  }
}
Terminate an active Worker by a workerId that was passed to defineWorkerModule.
This only terminates the Worker itself; the worker module will remain available
and if you call it again its Worker will be respawned.
@param {string} workerId