Fix ReportWriter close function

Make a member of the ReportWriter class.
Change output file ext. in spreadsheet script