The Hamiltonian structure of the second Painlevé hierarchy