A periodic boundary value problem for the Sine-Gordon equation, small Hamiltonian perturbations of it ,and KAM-stability of finite-gap tori