Pseudo-Riemannian metrics on closed surfaces whose geodesic flows admit nontrivial integrals quadratic in momenta