Make sure mbgl.Map is not holding any references to the node's main loop and thus preventing the node from exit.