Fix termination of DialogCocoa

The DialogCocoa would not quit if auto-close was set every time. This seems
to be some kind of race that can make the signals arrive in different order.
This small change fixes auto-close for all cases.