Make sure we actually end the script properly and clear window properties