Assuming you're using visual studio; pressing CTRL+E, D will re-format your document to the configured conventions, which should make the fundamental problem obvious - the braces are indeed unbalanced:
It looks like you are missing 2 }
braces, to end the class
and the namespace
scopes. However, it could also be that there are oddities in the code logic itself, re braces.
Note: the reformat option is also available via the menus - Edit -> Advanced -> Format Document: