Move saved event to before dialog close
Add 'closing' event to dialog close

Allows to cancel the close:

	some_detail.handle('closing', function(should) {
		should.close = false
	}).
Delete unsaved documents on cancel

This is mostly because at that point, some important properties like
the document category have not yet been set.