Reset messagesSize after pending writes are flushed.