Lock mutex during more of the log rotation process (attempting to prevent crashes that have been seen while logging at the same time as log rotation)