core: simplify gpiod_chip_close()
core: simplify gpiod_chip_close()

Use a temporary pointer for GPIO lines and helpers for reading the
line state.

Signed-off-by: Bartosz Golaszewski <108de5fbc428215dc26df4468b48691526611148@gmail.com>

brgl/libgpiod,clemensg/libgpiod,clemensg/libgpiod,brgl/libgpiod,brgl/libgpiod,brgl/libgpiod