Issue 7079: check that the debugger is set before destroying