compact metric space definition by closed covers

My book says the following:

A metric space is compact iff:

$$M=\cup A_{\lambda}\implies M = A_{\lambda1}\cup\cdots\cup A_{\lambda_n}$$

where each $A_{\lambda}$ is open. Then, it says that if $A_\lambda$ is a family of open sets in $M$, then the complementars $F_\lambda = F-A_\lambda$ forms a family of closed sets in $M$.We have, then: $\color{Red}{M=\cup A_\lambda\iff \cap F_\lambda = \emptyset}$. Where this came from?

$$M \setminus (\cup_{i \in I} A_i) = \cap_{i \in I} (M \setminus A_i)$$
$$M \setminus (\cap_{i \in I} A_i) = \cup_{i \in I} (M \setminus A_i)$$
when $A_i, i \in I$ are subsets of $M$. The first one with $A_\lambda$ for $A_i$ for covering $A_\lambda$ is $\emptyset$ on the left hand side, and so the intersection is empty, and vice versa.
But in your case it's easy to reason as well: if $M = \cup_\lambda A_{\lambda}$, then, if $x \in M$, $x$ is in some $A_\lambda$, which means for that $\lambda$, it's not in $F_\lambda$, so $x \notin \cap_{\lambda} F_\lambda$. So the latter set is empty (no $x\in M$ lies in it). And reversely, if the intersection is empty, then for every $x \in M$, there is some $\lambda$ such that $x \notin F_\lambda$, so $x \in A_\lambda$ for that same $\lambda$, and the $A_\lambda$ cover $M$.