basic_vmem_wrapper: more proper closing