The viscosity of polyatomic gases in a magnetic field