Hitting Cmd-, instead of Cmd-period

When I hit Cmd, instead of Cmd. to stop a script, SD starts displaying the revolving pizza while the script keeps on running. The whole thing feels very slow. And then the mistakenly called Preferences get displayed.

I would expect the call to Preferences be instantly handled while the script is put in the background.