Pass spreadsheet file as a parameter in script

Pass the xls file as a parameter to the spreadsheet writing functions.
Add close function to report writer