Fixed close event to work with cmd-Q on Mac