Fix minor issue in close_device().