The terminate() method of the Worker interface immediately terminates the Worker.
terminate()
MDN Reference