Fixes to JSON body parsing in built in router, and dialogClose not properly cleaning on on open/save dialog.

I've essentially did a bit of clean up in 2 areas:

  * The built in router was somewhat defficient in parsing of JSON bodies.
  * The MAC native window code had issues in terms of cleaning up after itself in the context of an open/save dialog.

It would be nice to get these integrated so others can benefit.

Note, there still appears to be an issue (at least on MAC) when an open/save dialog is canceled. A new one cannot subsequently be opened. I'll take a look at that when I get a chance.