HINT $\ $ Given any fraction $\rm\:w\:$ witnessing that the nonmaximal order $\rm\:D\:$ is not integrally closed, i.e. a proper fraction over $\rm\:D\:$ that's a root of a monic $\rm\:f(x)\in D[x]\:,\:$ the proof below shows, for the fractional ideal $\rm\ I = (w,1),\ \ I^{\:n} =\: I^{\:n-1}\:,\:$ but $\rm\ I\ne 1\:$ (by $\rm\:w\not\in D$), $\:$ contra unique factorization.
Here $\rm\: n=2,\ w = (-1 + \sqrt{-3})/2\ $ is integral over $\rm\:D = \mathbb Z[\sqrt{-3}]\:,\:$ being a root of $\rm\:x^2+x+1\:.$ Alternatively, clearing denominators from the fractional ideals to obtain integral ideals, we obtain $\rm\ J^2 =\ 2\ J\:,\:$ but $\rm\ J \ne (2)\:,\:$ for $\rm\ J = 2\ (w,1) = (-1+\sqrt{-3},2)\:,\: $ also contra unique factorization. For further remarks, including relations with Dedekind's conductor ideal and irrationality proofs, see my discussion with Gerry Myerson in this sci.math thread circa May 20, 2009.
THEOREM $\ $ Dedekind domains $\rm\:D\:$ (so PIDs) are integrally closed.
Proof $\ $ Suppose a fraction $\rm\:w\:$ over $\rm\:D\:$ is integral over $\rm\:D\:,$ i.e. in terms of fractional ideals over $\rm\:D\:$
suppose $\rm\:\ \ w^n\:\ \in\:\ (w^{n-1},\ldots,w,1)\quad\quad\ \ [*]$
Now $\rm\: (w,1)^n\ =\ (w^n,w^{n-1},\ldots,w,1) $
$\rm\quad\quad\quad\quad\quad\quad\quad\quad =\ (w^{n-1},...,w,1)\ $ by $\ [*] $
Thus $\rm\ (w,1)^n\: =\ (w,1)^{n-1}\ $
Thus $\rm\ (w,1)\ =\ (1)\ $ by cancelling the invertible ideal $\rm\:(w,1)^{n-1}\:.$
Hence $\rm\ w \in (1) = D\:.\ $ Therefore $\rm\:D\:$ is integrally closed. $\quad$ QED
REMARK $\ $ A common similar proof uses $\rm\ I^2 =\: I,\ \ I = (w^n,...,w,1)\:.$
NOTE $\ $ If fractional ideals are unfamiliar then one may clear denominators from the prior proof by scaling it by $\rm\ b^n\:,\:$ where $\rm\ w = a/b\:,\:$ i.e.
$\rm\quad\quad\quad\quad (w,1)^n\ =\ (w,1)^{n-1}\ $ which, upon scaling through by $\rm\ b^n\ $
$\rm\quad \Rightarrow\quad (a,b)^n\: =\: b\ (a,b)^{n-1}$
$\rm\quad \Rightarrow\quad (a,b)\ =\ (b)\ \ $ by cancelling the invertible ideal $\rm\ (a,b)^{n-1}\: $ from above
$\rm\quad \Rightarrow\quad b\: |\: a\ $ in $\rm\: D\ $ i.e. $\rm\ a/b\in D\:.$