fix the bug that fileRotate() could be invoked more than once