We denote by $\mathbb{2}$ the two element field $\mathbb{Z}/2\mathbb{Z} =\{0, 1\}$.
Let $X$ be a set.
We denote by $\mathbb{2}^X$ the set of maps $X \rightarrow \mathbb{2}$.
We make $\mathbb{2}^X$ into a ring with pointwise addition and multiplication.
We denote by $\chi_A$ the characteristic function with respect to a subset $A$ of $X$.
We regard $\chi_A$ as an element of $\mathbb{2}^X$ in the obvious way.
Let $A, B$ be subsets of $X$.
We denote by $A\Delta B$ the symmetric difference of $A$ and $B$, i.e. $(A - B) \cup (B - A)$.
It is easy to see that $\chi_{A\Delta B} = \chi_A + \chi_B$.
It is also easy to see that $\chi_{A\cap B} = \chi_A\chi_B$.
Lemma 1
Let $X$ be a set.
Let $A, B, C$ be subsets of $X$.
Then $(A\Delta B)\cap C = (A\cap C) \Delta (B\cap C)$.
Proof:
$\chi_{(A\Delta B)\cap C} = \chi_{A\Delta B}\chi_C = (\chi_A + \chi_B)\chi_C = \chi_A\chi_C + \chi_B\chi_C = \chi_{A\cap C} + \chi_{B\cap C} = \chi_{(A\cap C) \Delta (B\cap C)}$.
Hence $(A\Delta B)\cap C = (A\cap C) \Delta (B\cap C)$.
QED
Lemma 2
Let $X$ be a set.
Let $A, B$ be subsets of $X$.
Then $A\Delta B = \emptyset$ if and only if $A = B$.
Proof:
Suppose $A\Delta B = \emptyset$.
Then $\chi_{A\Delta B} = 0$.
Hence $\chi_A + \chi_B = 0$.
Hence $\chi_A = -\chi_B = \chi_B$.
Hence $A = B$.
The converse is clear.
QED
Definition 1
Let $X$ be a topological space.
A subset of $X$ is called quasi-constructible if it is a finite union of locally closed subsets of $X$.
Lemma 3
Let $X$ be a topological space.
A finite union of quasi-constructible subsets of $X$ is quasi-constructible.
A finite intersection of quasi-constructible subsets of $X$ is quasi-constructible.
The complement of a quasi-constructible subset of $X$ is quasi-constructible.
Proof:
Clear.
Lemma 4
Let $k$ be a field.
Let $X$ be a $k$-scheme locally of finite type.
Let $X_0$ be the set of closed points of $X$.
Let $Y$ be a non-empty locally closed subset of $X$.
Then $Y \cap X_0$ is non-empty$.
Proof:
This can be proved exactly in the same way as my answer to this question.
Lemma 5
Let $k$ be a field.
Let $X$ be a $k$-scheme locally of finite type.
Let $X_0$ be the set of closed points of $X$.
Let $Z$ be a non-empty quasi-constructible subset of $X$.
Then $Z \cap X_0$ is non-empty$.
Proof:
This follows immediately from Lemma 4.
Lemma 6
Let $k$ be a field.
Let $X$ be a $k$-scheme locally of finite type.
Let $X_0$ be the set of closed points of $X$.
Let $Y_1, Y_2$ be locally closed subsets of $X$.
Suppose $Y_1 \cap X_0 = Y_2 \cap X_0$.
Then $Y_1 = Y_2$.
Proof:
By Lemma 1, $(Y_1\Delta Y_2)\cap X_0 = (Y_1\cap X_0) \Delta (Y_2\cap X_0) = \emptyset$.
Since $Y_1\Delta Y_2$ is quasi-constructible, $Y_1\Delta Y_2 = \emptyset$ by Lemma 5.
Hence $Y_1 = Y_2$ by Lemma 2.
QED
Proposition
Let $k$ be a field.
Let $X$ be a $k$-scheme locally of finite type.
Let $X_0$ be the set of closed points of $X$.
Let $Y$ be a locally closed subsets of $X$.
Suppose $Y \cap X_0$ is closed in $X_0$.
Then $Y$ is closed in $X$.
Proof:
There exists a closed subset $Z$ of $X$ such that $Y \cap X_0 = Z\cap X_0$.
Then $Y = Z$ by Lemma 6.
QED