libiio: "Device or resource busy" when creating buffers


We are using an FMCOMMS4 board with the Zedboard SoC.

For our application, we're writing our software in C using libiio. Most of the work is based off the provided sample code, found here: libiio/ad9361-iiostream.c at master · analogdevicesinc/libiio · GitHub 

Here's the problem: if another program that uses the libiio buffers gets run (and even if it is closed, or even force-quit) then our program ceases to open buffers. Furthermore, if our program crashes or gets force-quit, the buffers are still rendered unavailable.

The only solution we've found is to reboot the SoC.  Reloading the iio kernel module is impossible (I think it was compiled into the kernel), and restarting iiod does not fix the problem. Killing all processes that could possibly be using libiio doesn't help.

Does anyone know how to fix this problem without rebooting the system?

P.S. For prosperity, I have attached our C code to this post.