add delay to autosave in beforeunload

allows forceful 'discard changes' by reloading the page and dismissing the warning, which @fperez really wanted today.

The timer doesn't start until after the dialog is dismissed, so if you decide to nav away without saving changes, the changes will actually not be saved.