Reordered destroy window and execute script