Add a shutdown event listener through service provider

Signed-off-by: crynobone <crynobone@gmail.com>