jcwren suggested "I can't remember if Win98 supports pipes like NT/Unix. I wonder if it's using a temp file, and when the file is empty it's automatically closing it. Perhaps the error is from trying to close an already closed file." So I changed the code to do
close(IPCONFIG);
last;
after I had recognised the IP Address and the warning message has gone.
Thanks for that useful advice.