Fixed "fileName" undefined variable error
Added logging.flushAndEnablePrinting()