fixed logging to file.  File no longer closes after one logging.