Cyclotron amplification of whistler waves by electron beams in an inhomogeneous magnetic field