Reopen the correct filename when -logfile is given