SERVER-10554 Patch memory leak in aggregation

The issue was that empty documents are represented as a NULL pointer and
Value didn't ref count NULL pointers. This is fine for all public
interactions with Value, however MutableDocument can change the pointer
in-place when updating a nested field. This caused a leak when it
transitioned a Value from holding a non-refcounted NULL pointer to
holding a real pointer since MutableDocument/MutableValue didn't set the
refCount bit.
Add check to prevent future memory leaks like SERVER-10554