heap_open and close helpers