fix a bug about window.close called.