handled loan close functionality