tools/bootconfig: Fix to check the write failure correctly