Add Windows shutdown handler
Summary:
Exit properly when clicked the red X of Windows Console.
Backport of core PR13131:
https://github.com/bitcoin/bitcoin/pull/13131/files
Test Plan:
make check
Cross build for windows.
Run bitcoind.exe in a console and exit with the "red X" (or hit
CTRL+C) button of the console. The software should terminate
gracefully (previously it would abort on an assertion failed in
scheduler destructor).
Reviewers: #bitcoin_abc, deadalnix, jasonbcox
Reviewed By: #bitcoin_abc, jasonbcox
Differential Revision: https://reviews.bitcoinabc.org/D4460