IIOD: Wait for the R/W thread to exit before returning from CLOSE

Otherwise, if we send a different command which requires the device to
be closed before it is effectively closed, we will get a -EBUSY error.

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>