add a try loop around EndModal on the optionsDialog
actually a neater way than try except loops