Spin-down of protostars through gravitational torques