The divisor function $d_3(n)$ in arithmetic progressions