Well, take the two-point indiscrete space $X=\{a,b\}$ and let $A=\{a\}$. Then $A'=\{b\}$, which is not closed.
Here is a more sophisticated example which is even $T_0:$
Let $X=[-1,1]$ and for $0$ take as a neighborhood base
$$\mathcal N_0=\{(-\varepsilon,\varepsilon)\mid \varepsilon>0\}$$
for an $x\ne0$ take as a local base
$$\mathcal N_x=\{\{x\}\cup(-\varepsilon,\varepsilon)\mid \varepsilon>0\}$$
It is easy to verify the axioms for a system of neighborhood filter bases.
Now, $A=\{0\}$ has the derived set $X-\{0\}$ which is not closed.
Here is a proof that in a finite $T_0$ space, and more general in a $T_0$ space where each point has a smallest neighborhood, all derived sets are closed:
Let $X$ be such a space, and $A\subset X.$ Let $y\in\overline{A'}$. If $U$ is the smallest neighborhood of $y,$ then $U$ is open and contains some $x\in A'.$ By $T_0$ there is a neighborhood $V$ of $x$ such that $y\notin V$. Since $U$ is open, $U\cap V$ is also a neighborhood of $x$ and must intersect $A-\{y\}.$ This shows that each neighborhood of $y$ intersects $A-\{y\},$ hence $y\in A'.$