Why is the destructor called twice after the pointer was deleted?