Liquid-metal flow in a rectangular duct with thin metal walls and with a non-uniform magnetic field