mac: Fix crash when closing window, closes #504.
mac: Make cmd+~ work for devtools window, fixes #508.