Are you constrained to using Euler angles? If you can decide freely what representation to use, quaternions would be preferable. In that representation, it's very easy to find which of two quaternions representing a rotation (which differ only by a sign) is closer to a given one.
With Euler angles, if you want the representation to be continuous, you can let the angles range over $\mathbb R$ instead of restricting them to a single (half-)period. However, choosing the nearest of the equivalent representations will then be more complicated than with quaternions. Quite generally, a lot of things that are nasty, complicated and potentially numerically unstable with Euler angles become nicer and easier when you use quaternions.
[Edit in response to the comments:]
There are three equivalences, one obvious, another less obvious and a third only applicable in certain circumstances.
The obvious one is that you can always add multiples of $2\pi$ to any of the angles; if you let them range over $\mathbb R$, which you must if you want to get continuous curves, this corresponds to using $\mathbb R^3$ as the parameter space instead of the quotient $(\mathbb R/2\pi\mathbb Z)^3$. This equivalence is easy to handle since you can change the three angles independently, that is, if you change one of them by a multiple of $2\pi$, you directly get the same rotation without changing the other two parameters.
What's less obvious is that (referring to this image) the transformation $(\alpha,\beta,\gamma)\rightarrow(\alpha+\pi,-\beta,\gamma+\pi)$ leads to the same rotation. (This is why, in order to get unique angles, $\beta$ has to be limited to an interval of length $\pi$, not $2\pi$.)
A third equivalence comes into play only if $\beta\equiv0\pmod\pi$, since in this case $\alpha$ and $\gamma$ apply to the same axis and changing $\alpha+\gamma$ doesn't change the rotation. If your rotations are arbitrary and have no reason to have $\beta\equiv0$, you won't need to consider this case, though it may cause numerical problems if you get close to $\beta\equiv0$ (which is one good reason to use quaternions instead of Euler angles).
These three transformations generate all values of the Euler angles that are equivalent to each other. Remember that you also have to consider combinations of them, e.g. you can add multiples of $2\pi$ in $(\alpha+\pi,-\beta,\gamma+\pi)$ to get further equivalent angles.