Remove the global summary filename and file pointer; pass them in to the summary functions as needed. Error check the results of buffered I/O calls.