Hamilton-Jacobi theory for periodic control problems