close that iframe document after writing to it
(cherry picked from commit 11e7af06e9f92d290acaef68cbd175a7fbaee46e)