Fix leaking file handle

Hello,

This commit make sure we release the file handle in the case the call `open()` succeeded but subsequent calls to `ioctl()` failed.

It is not *that* important, but coverity scan spotted that and well, why not fix it.