fix dialog close behaviour