Why does the roll and yaw/heading values show large errors when the pitch approaches ±90 degrees?
This is caused by an (mathematical) artifact in the description of Euler-angles (also known as Cardan angles). In the Euler-angles description of orientation there is a singularity (also called “gimbal-lock”) when the pitch is +90 deg or -90 deg. This means that, as the pitch approaches ±90 deg the output angles in the yaw and roll will start to fluctuate greatly and that you will not reach pitch = ±90deg.