Notice period
When you move out from an apartment, check the notice period in your lease contract. It tells how long before you need to notify your lessor of the move.
If you want to move out of the apartment for example on December 1, you should give notice no later than October 31. Otherwise, you will also have to pay the December rent.
If you do not abide by the contract, you may not be able to get your deposit back.
Note that it is not always possible to terminate a fixed-term lease before its end.