Properly close the heredoc we pass to phantomjs