Fix #5626 - bug with closing merge dialog