Yes. However, some lenders will charge you a prepayment penalty. Lenders make a profit with loans because of the interest rate. When you repay them before the expected date, they lose interest money.
That is not a rule for all lenders, though. Before applying for any loan, make sure about how your lender proceeds in all scenarios.