Updated Order of event triggering to allow listeners on close and cancel...

... to set preventClose()

Also added in the event handler for 'close' so it may be listened to separately.