Nothing u can do it if it is mentioned in the agreement....
But u can do one thing to recover your advance money before leaving the flat look for the other tenant for your replacement...and you can get the advance from the new tenant .