Fix unclosed handles in get_process_memory
Add missing break
Fix possible null pointer dereference