Using correct method for closing dialog