fixed a bug when too many log files are opened