I suggest you change the code that creates the click listener Markerthat your InfoWindow will open by adding code similar to the following example:
google.maps.event.addListener( marker, "click", function() {
var bubble = new google.maps.InfoWindow({
content: buildBubbleContent( param1, param2 )
});
bubble.open( map, marker );
google.maps.event.addListenerOnce( marker, "visible_changed", function() {
bubble.close();
});
});
As discussed in the question: How to clear InfoWindow when the associated token is hidden? :