Adding useful hideDialog method that runs on the UI thread