Add a check around an optional function

My game crashes here if I update phaser.js to a new version. It happens
when my game switches to another State object.
Merge pull request #1024 from lucbloom/if-onShutDownCallback

Add a check around this optional function