Issue 416: Pass number of elements to beginWriteDictionary

If the (begin/end)WriteDictionary functions of the serializer accept an integer argument, pass the number of elements in the dictionary.