More cleanup to device close in fixes requested by @bjz