I was able to answer my own question. Instead of creating a separate array in which I was keeping the name of the layer, I used .id of the Layer class to save the name and then used the getLayer function to pull the ids back out. Once I did that, I was able to turn on and off any kml layers on the map.