The code you're using doesn't close the infobox. The other thing that comes into play is using just one infobox and adding and removing the info from the infobox. (which is what the first five lines of code does). This is the code I'm using.
parkMarker.push(marker);
parkOptions.push(markerOptions);
parkMarker[arrayLoc].infobox = new InfoBox(parkOptions[arrayLoc]);
parkMarker[arrayLoc].infobox.open(map, marker);
parkMarker[arrayLoc].infobox.close();
google.maps.event.addListener(parkMarker[arrayLoc], 'click', (function(marker, arrayLoc){
return function(){
for ( h = 0; h < parkMarker.length; h++ ) {
if(parkMarker[h].infobox){
parkMarker[h].infobox.close();
}
}
marker.infobox.open(map, marker);
}
})(parkMarker[arrayLoc], arrayLoc));
This jsfiddle doesn't work, but it has all the code I use to get this to work: http://jsfiddle.net/UDRmz/1/