Added an event to be fired when leaving the page regardless of whether form was dirty or clean

Because DirtyForms overrides usual beforeunload event flow, it is no longer possible to use beforeunload to perform some last second cleanup (release object locks that user might have; log something; etc). This patch adds beforeunload.dirtyforms event to do just that.