Diffusion, thermalization, and optical pumping of YbF molecules in a cold buffer-gas cell