Effect of magnetic field on terahertz generation via laser interaction with a carbon nanotube array