Getting advance rent back

I recently moved out of my flat and found a new tenant to takeover. My landlord required me to pay the last 2 months rent in advance when i signed the contract (july to september). I was wondering whether I could get those 2 months of rent back because the replacement tenant has already moved in/payed the last 2 months of rent in advance too and signed the contract.
When I initially asked before finding the replacement tenant they told me I would get the money back based on when my contract ends, but I have tried contacting them about it recently and my messages keep being ignored so i’m not sure if this means i can’t get it back. Help on this situation would be appreciated, thank you.

They’re not allowed to rent the property to two different people at the same time, so if the tenant is occupying for a period for which you’ve already paid rent, they must refund that as its your money. I would suggest you send them a Letter Before Action demanding the refund.

If the landlord/agent released you early from a contract, what was the arrangement?

That sounds very like a prohibited payment breaking the maximum deposit rules. Speak to Shelter.