Fixes #1868: Fixed quit behaviour on Mac