Landlord not letting me move out

Hello, I have been living in a rented flat for last 8 months. I didn't sign any rental agreement with landlord. Now, I want to move out of this flat due to personal reasons but my landlord is not letting me move out. If I understand it correctly, a lease without a rental agreement will be treated as a month-to-month lease but still I gave my landlord 2 months notice (August and September) just to make sure he has enough time to find another tenant but he says that I can't go without completing a year and if I go, I'll have to leave my 2 months security deposit which I had given to him at the start of my tenure. What should I do in this case ? Is this ok if I don't transfer the rent for September and adjust it against 2 months security deposit, move out in September end and ask him to refund one month security deposit (personally I don't want to do that but I just want to ensure that I don't miss my security deposit) ? Or is there a way I can recover my 2 months deposit after I pay September rent as well asnd then move out in September end ? Please advise. Regards, Rachit