Handle dialog type windows popping up and closing