gpt: fix error reporting on partition table write failures