iio: Check fd against != -1 and not > 0 and avoid leaks during error handling