Close document within last script