The NERDTree commands are custom Ex commands, so you invoke them (interactively) via :NERDTreeCWD followed by Enter. In a Vimscript, you can drop the : prefix.
Maybe part of the confusion (also seen in the comments) arises from the fact that the NERDTree commands are implemented by global functions with the same name:
:verbose command NERDTreeCWD
Name Args Address Complete Definition
| NERDTreeCWD 0 call NERDTreeCWD()
So you could also bypass the custom function and call NERDTreeCWD() directly, but this would make you depend on implementation details of the plugin, and is therefore discouraged.
Implementing NERDTree toggling
Are you aware that the plugin already has a :NERDTreeToggle command?
Also, you don't need to define your own flag variable (g:open) - just reuse the one from the plugin (exposed via the g:NERDTree.IsOpen() function). Yes, this makes you depend on plugin details (but this looks like a public API, not internal implementation, so it should be far more stable) - it's still better than trying to reinvent the wheel. (Your global flag would have problems with multiple tab pages - each could have a NERDTree active or not.)
executebecause you don't do evaluation. And you need(). So:g:NERDTreeCWD()andg:NERDTreeClose().g:for functions, only for variables (seehelp :g). So:NERDTreeCWD()