moved the isRestarting clear to take place AFTER the emit 'running' event and to be on the safe side, to take effect at the nextTick