I found the solution to the problem. I needed to call .clearLayers() before calling the .addData() method on the geojson variables, like so:
map.on('overlayadd', function(eventLayer){
if(eventLayer.name === "median age"){
$.getJSON("http://localhost/flare7.json", function(data){
medAgeLayer.clearLayers();
medAgeLayer.addData(data);
});
}
else if(eventLayer.name === "Population"){
$.getJSON("./flare5.json", function(json){
popLayer.clearLayers();
popLayer.addData(json).addTo(map)
});
};
});