Factorization of some classes of matrix functions and the resolvent of a Hankel operator