Group identities on the units of algebraic algebras with applications to restricted enveloping algebras