Fixed dialog closing