Prove $E$ is disconnected iff $\exists$ nonempty sets $A$ and $B$ in $M$ satisfying $A\cap \bar B=\emptyset$, $B\cap \bar A=\emptyset$ and $E=A\cup B$

Prove that $E$ is disconnected if and only if there exists nonempty sets $A$ and $B$ in $M$ satisfying $A\cap \bar B=\emptyset$, $B\cap \bar A=\emptyset$, and $E=A\cup B$.

My attempt:

$(\Rightarrow)$ Suppose $E$ is disconnected. Then there exist nonempty open sets $A$ and $B$ such that $A\cap B=\emptyset$ and $A\cup B=E$.

Since $A$ and $B$ are both open and closed in $E$, then $A=\bar A$ nad $B=\bar B$. So $A\cap \bar B =\emptyset$ and $B\cap \bar A=\emptyset$, and $E=A\cup B$.

$(\Leftarrow)$ Suppose $A\cap \bar B=\emptyset$, $B\cap \bar A=\emptyset$, and $E=A\cup B$.

$A\cap \bar B=\emptyset$ $\Rightarrow$ $A\cap B=\emptyset$.

$B\cap \bar A=\emptyset$ $\Rightarrow$ $B\cap A=\emptyset$.

However, I don't know how to show that $A$ and $B$ are open.

HINT: Can you show that $A=(\overline{B})^c$? Why does that imply that $A$ is open? (And similarly for $B$.) Remember that the closure of a set contains the set itself . . .
Since $E = A \cup B$ and $A\cap \overline{B} = \emptyset$ we must have $\overline{B}\subseteq B$. Therefore $A$ is open.
Note that $A^c=\overline{B}$. This means that $A$ is open.