One option is to keep a global reference to the KmlLayer
var kmlLayer = null;
function addKmlLayer(kmlURL) {
kmlLayer = new google.maps.KmlLayer({ url: kmlURL });
kmlLayer.setMap(my_map);
}
Then to hide it, this will work:
kmlLayer.setMap(null);
Might want to do:
if ((kmlLayer != null) && kmlLayer.setMap) kmlLayer.setMap(null);