Confinement effects on energy harvesting by a heaving and pitching hydrofoil