Fix bug that prevented writing optional Avro records, arrays or maps

The writeValue method in AvroWriteSupport would correct resolve
the non-null type but would incorrectly try to write records,
arrays and maps with the union schema triggering e.g.
AvroRuntimeException: Not an array: ["null",{"type":"array","items":"int"}]