Detach reliably closing all descriptors

Thanks: Matthew Gabeler-Lee
Closes: #755518