Close file if error occurs in GFileWriteAll(char* filepath, char *data)