Fix early shutdown
Merge pull request #710 from benfitzpatrick/early-shutdown-fix

Fix early shutdown