I am having the same problem you had. Thanky you for posting your solution. What did you do to change the line
w=window.open(null, ‘Print_Page’, ‘scrollbars=yes’);
Did you do anything to edit any other lines or did you just insert the w.document.close(); line on the line before w.print(); ?