Refactor GIO error checking in C++ wrapper

Check the return value of g_output_stream_write_all().

Found with Coverity (CID 1203401, CID 1203402 and CID 1203403)