Clearly there are geodesics which are not periodic. Take the maximal torus of say $SO(4)$, and let 
\begin{equation} 
X = \left(\begin{array}{cc} J & 0 \\
 0 & \alpha J \end{array}\right) 
\end{equation}

 be in block diagonal form, where $J = \left(\begin{array}{cc} 0 & 1  \\ -1 & 0 \end{array}\right)$, with $\alpha$ irrational. Then the geodesic generated by $X$ will be dense in the set of 2x2 block diagonal elements of $SO(4)$, but is not the whole set, hence can't be closed.