Correct the count of bytes written to the initial FLV buffer

This matters if the buffer overflows, when the count is used
for patching the buffer back together. This happens if there
are multiple video packets with zero timestamp at the start
of the stream (before any audio packets), enough to fill the buffer.
Free the extra read buffer if the initial FLV buffer overflowed

This fixes a leak in this cornercase.
Fix leaks in AMF objects that contain arrays