Hi Sarah,
Just out of curiosity, does the “remove all access” option in the identity profile not work for you? It would be a better and more efficient way to remove access when the identity becomes inactive.