Set the read and write threads for avalon to not cancel within libusb functions and wait for the threads to pthread_join on shutdown.