Sodium cyanoborohydride and iminium reductions
I believe the reaction effected in the third step is a reductive amination. In this case, the ketone and amine moieties are both present within the same molecule, so the reaction proceeds intramolecularly. The $\ce{TsOH}$ is an acid, presumably serving to protonate the carbonyl oxygen and activate the carbon toward nucleophilic attack by the amine. As the iminium group forms (with concomitant loss of water), it is rapidly reduced to an amine by the $\ce{NaBH3CN}$. After workup, the final product is: