exit() {
        this._sendMessageToChild({ cmd: 'exit' });
        // If the worker is busy in a while(true); kind scenario, it's event loop won't be able to respond to our message,
        // and therefor will never exit, we must force it.
        // See: e2e/main.spec.js#should kill worker that got stuck in an infinite loop
        this._exitTimeoutId = setTimeout(() => {
            if (this.workerType === "thread") {
                console.warn(`ThreadID: ${this.child.threadId} did not exit after ${EXIT_WAIT_TIME_MS}ms, calling terminate().`);
                this.child.terminate();
            } else if (this.workerType === "process") {
                console.warn(`PID: ${this.child.pid} did not exit after ${EXIT_WAIT_TIME_MS}ms, sending SIGTERM.`);
                this.child.kill('SIGTERM');
            }
        }, EXIT_WAIT_TIME_MS);
    }
Stops the worker process. It results in a trigger of an 'exit' event.