You'll want to register a location change listener. Then when you move to page 2 you can set a global variable or remove the close listener. Your choice.
window.plugins.childBrowser.onLocationChange = function(loc) {
if (loc == "page1.html") {
window.plugins.childBrowser.onClose = function() {
alert("close");
};
} else if (loc == "page2.html") {
window.plugins.childBrowser.onClose = null;
}
};