Talk to your landlord and settle the lease and deposit before you leave, and plan ahead because your visa timing limits how long you can stay to complete the handover.
Nationwide (all cities)
Settle it and plan ahead
You should settle your lease and deposit before you leave, and you need to plan the timing ahead.
Why timing matters
The Guangzhou Liwan District government lists 'off-lease procedure' as one of the 14 things foreigners need to do before leaving China. The key point it makes is about timing: because your visa sets a limit on how long you can remain in China, you should discuss the lease termination and deposit return with your landlord well before your departure date.
In practice
In practice this means: give your landlord notice as early as your lease requires, arrange a handover inspection of the property, settle any outstanding rent and utilities, and agree on when and how the deposit will be returned. Getting the deposit back after you have already left the country can be more difficult, so aim to have the deposit returned, or at least the return terms confirmed in writing, before you go.