Let $S \subset X$, where $X$ is an affine scheme of finite type over $k$ and $S(k)$ is not empty.
Let us suppose that the set of points of $S(k)$ is inside of the interior $\text{int } S$, that is, whenever $x \in S(k)$ there exists $f \in \mathcal{O}(X)$ such that $x \in X_f \subset S$.
Using this, I want to prove that the set $S$ is open.
Of course if $p \in S$ is not closed in $X$, but there is a closed point $x \in S(k)$ such that $x \in \overline{\{p\}}$, arguing using the corresponding ideals is enough to prove that $p \in \text{int } S$.
I removed this discussion from the context because I believe that this should be enough to prove the statement. If anyone has a counterexample, maybe I should restrict my hypothesis to get this.
EDIT: As pointed out, maybe the lack of context is making this harder. I am following Victoria Hoskins's notes on Geometric Invariant Theory ( https://userpage.fu-berlin.de/hoskins/M15_Lecture_notes.pdf ). At Proposition 4.36, she proves that the set of stable points of an action of a reductive group on an affine scheme $X$ (of finite type over $k$) is an open set using this argument.
what do you mean a closed point $x\in S(k)$? we don't know yet if $S$ is the underlying topological space of a scheme or not so $S(k)$ is meaningless. if you really mean that $S$ is a subsheme of $X$ and you only put the condition of $S(K)$ then as people said in the comments this is false.
but if you really mean for any closed point of $S$ then this is true because consider $U=interior\, of \,S$ then $Z=S-U$ is closed inside $S$. now take any maximal point $t$ of $Z$ (which exists by finiteness condition). then $t=\bar{\{t\}}\cap Z$ so $t$ is closed in $S$ but it is not in $U$ which is a contradiction.