Cocoa: Handle gracefully closing a window without event dispatcher

Task-number: QTBUG-36696

Change-Id: I799eb351ee8ac1529cfbf009df3e7d57ec3a24ea
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>