Let $U=\mathbb R^n\setminus \lbrace0 \rbrace\subset \mathbb R^n$, a simply connected domain for $n\geq3$, which we assume from now on.
The $(n-1)$ form $\omega \in \Omega^{n-1}(U)$ defined by
$\omega (x)=\frac {1}{\mid \mid x\mid \mid^n} \sum _{i=1} ^n (-1)^{i-1}x_idx^1\wedge...\wedge \widehat{dx^i} \wedge dx_n$ for $x\in \mathbb R^n\setminus \lbrace0 \rbrace)$ is closed but not exact. It is thus an example of what you want.
More precisely, its cohomology class $[\omega ]$ generates the one-dimensional $(n-1)$-th De Rham cohomology vector space of $U$, namely $H^{n-1}_{DR}(U)=\mathbb R\cdot[\omega ]$
NB
a) This form can also be seen as the pull-back $\omega =r^*(vol)$ of the canonical volume form $vol\in \Omega ^{n-1}(S^{n-1})$ of the unit sphere under the map $r:U\to S^{n-1}:x\mapsto \frac {x}{\mid \mid x\mid \mid}$
b) To be quite explicit, the value of the alternating form $\omega (x)$ on the $(n-1)$-tuple of vectors $v_1,...,v_{n-1}\in T_x(U)=\mathbb R^n$ is $\omega (x)(v_1,...,v_{n-1})=\frac {1}{\mid \mid x\mid \mid^n}\cdot det[x\mid v_1\mid ...\mid v_{n-1}]$
where of course $x, v_1, ...,v_{n-1}$ are seen as column vectors of size $n$.