several test to fix memory leak. window.close has finally fixed it