log rotate, kill background threads properly