Use the setting in official FAQ to quit vim automatically when the only buffer left is nerdTree.