How to fix “snap refresh”: snap “…” has running apps

Problem:

You want to update your snap, e.g. signal-desktop, but when you try to snap refresh it, you see the following error message:

Error: cannot refresh "signal-desktop": snap "signal-desktop" has running apps (signal-desktop),
        pids: 471050,471137,471138,471189,471204,471248

Solution:

You can’t stop the running apps via snap. Just kill them using killall, for example:

killall signal-desktop && sudo snap refresh signal-desktop

Alternatively, you can kill the PIDs listed in the error message (you need to separate them by space, not by comma):

kill 471050 471137 471138 471189 471204 471248