Fixed a bug

When log is being refreshed to run logrotate, existing handlers were
not cleared properly.