fix: gracefully shutting down by alexander-akait · Pull Request #4145 · webpack/webpack-cli

What kind of change does this PR introduce?

fixes #2918
fixes #2919

Did you add tests for your changes?

Existing

If relevant, did you update the documentation?

No need

Summary

gracefully shutting down, so hooks will be called and cache will not be broken

Also we need it for webpack/sass-loader#1195

Does this PR introduce a breaking change?

No

Other information

No