gdb/ChangeLog:
2020-06-18  Pedro Alves  <palves@redhat.com>
	* bsd-kvm.c (bsd_kvm_target::close): Use switch_to_no_thread
	instead of writing to inferior_ptid directly.
+2020-06-18  Pedro Alves  <palves@redhat.com>
+
+       * bsd-kvm.c (bsd_kvm_target::close): Use switch_to_no_thread
+       instead of writing to inferior_ptid directly.
+
 2020-06-18  Pedro Alves  <palves@redhat.com>
 
        * corelow.c (core_target::close): Use switch_to_no_thread instead
 
       core_kd = NULL;
     }
 
-  inferior_ptid = null_ptid;
+  switch_to_no_thread ();
   exit_inferior_silent (current_inferior ());
 }