Properly cancel close event if dirty tabs are not saved