avoid having # in the URL when closing a dialog

We've had some minor issues with # in the URL.

* Open "Custom Template"
* Click on Cancel to close the dialog
* You've got a # at the end of the URL 

Depending on what you do, you'll have an interface which always jumps to the top, making it a tiny bit annoying to navigate.