Fix: protect close_write_flag with the rotation lock

Signed-off-by: David Goulet <dgoulet@efficios.com>