Necessary Condition for Periodic Orbits in Near-Hamiltonian Systems