gpt-utils: use open() and close() directly
When built and used with Debian 12, write fails like: block dev write failed: Bad file descriptor gpt_set_header: Failed to write back GPT header gpt_disk_commit: Failed to update primary GPT header update_slot_attribute: Failed to write back entry for xbl_a SLOT _a: Failed to mark boot successful
due to the fd beeing closed when entering the write function.
Directly use open() and close() and avoid using a C++ object for that.
Signed-off-by: Neil Armstrong neil.armstrong@linaro.org