Use scoped pointers for Exit and Properties dialogs

Also fixes a memory leak caused by creation of a new
Properties dialog each time.