fix rotating file handler write lock

This commit fixes a bug when RotatingFileHandler was always writing only
one log record to the file if it had already wrote a record before the
new one came in. This was caused by not setting write flag to false if
the buffer is empty.