Whistling when stepper motor stops

The "whistling" is due to the current limiting action of the motor driver, and there is nothing you can do about it.

The current limit must be adjusted according to the motor specifications and the required torque.