Improve write() logic.

Emit with delete flag and only invoke delete with string values
otherwise set to undefined to clear the pointer to complex objects.
0.1.15