Invokes 'Node::onExit' only when the node is running.