Fixed a modal bug where an exception would throw when closing a modal during loading

When loading a modal (like a Help modal), if you closed the modal while it was still loading, it would throw an exception afterwards. The issue was that it was trying to trigger an event on an object that had been destroyed on modal close.