worker: handle calling terminate when kHandler is null
This PR makes a change to the Worker.terminate() method when called if the kHandler is null. Before this pull request it was returning undefined, but the API is expecting a promise. With the changes in this PR if terminate is called and kHandler is null a resolved Promise is returned even if a callback is passed, to be consistent with the API surface, and with always return promises.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines