You can end your lease at any time, provided you give the required notice period.
If you want to leave your accommodation before the end of the lease, you must give notice at the residence reception desk or send it by registered mail at least 1 or 3 months before your departure date (the exact period is indicated in your lease, depending on the residence).