Delete Index from Cluster State

I am trying to ensure that indices created during testing do not persist in elasticsearch when it is restarted. To achieve this, I have modiifed the doStop() function of IndicesService in the following manner:

                        removeIndex(index, IndexRemovalReason.NO_LONGER_ASSIGNED, "shutdown");
                    else {
                        removeIndex(index, IndexRemovalReason.DELETED, "shutdown");

I am able to successfully delete the corresponding indices using this, but they are not getting removed from the cluster state. So next time when I start elasticsearch, it shows the following sort of message

recovered [1] indices into cluster_state

but in fact, the indices don't actually exist.

How do I update the cluster state as well?

Can you elaborate a little more on how you are identifying this?