Changed log_init so that previous (if any) is closed.