Fixed shutdown not being detected.