Event emitter and shutdown hook.