improved error logfile cleanup