Lemma 29.26.2. A flat closed immersion of finite presentation is the open immersion of an open and closed subscheme.

Proof. The affine case is Algebra, Lemma 10.108.5. In general the lemma follows by covering $X$ by affines. Details omitted. $\square$

In your comment you can use Markdown and LaTeX style mathematics (enclose it like $\pi$). A preview option is available if you wish to see how it works out (just click on the eye in the toolbar).