Finish loan function