Thermodynamics of heavy quarkonium in a magnetic field background