So if it says this in my contract it's invalid? How?
The specific clause is:
Except as provided in this chapter, every contract by which anyone is restrained from engaging in a lawful profession, trade, or business of any kind is to that extent void.
Most of the exceptions are regarding people who own and then sell the business, and a few others.Which is to say that your employer would remain powerless, that's how.
If your contract states that your employer can kill you if they so wish, it doesn't mean that they can; this would conflict with the law.