During log rotation, close file before renaming it