Fixed log() writing even if log file isn't open