Keep the log file open instead of opening/closing it each time