Electromechanical safety switches with guard locking