finish gradient descent