Almost periodicity of some error terms in prime number theory