Prevent JS error on reinitialising dialog

This PR isolates the fix referenced in [this commit by @r-a-y](https://github.com/cuny-academic-commons/cbox-theme/commit/3cee34ab386a57f4b5d991b339f1e9040da4e523) which prevents a JS error when reinitialising the Media Upload dialog.