Add shutdown event
Merge pull request #1139 from KorvinSzanto/master

Add shutdown event