Ok .. So I've figured it out and you can definitely cancel the first beforeClose event code is :-
main
Sub Main()
myIndesign.AddEventListener "beforeClose", getref("genPDFClose"), false
End Sub
Function genPDFClose(en)
rem ...do something here
rem if you want to cancel beforeClose the below two lines work!
en.stopPropagation()
en.PreventDefault()
End Function