You will need to check the terms of the lease, but as long as you have a legally valid reason for ending the lease, you should be able to recover your security deposit (if you haven't caused damage to the property). You may have to sue the landlord if he refuses to return your security deposit.