This kind of problem is very common, but not well documented, and occurs when using write-behind disk cacheing with Windows 95 (not sure about 98). There is a bug in the cache logic which fails to flush the buffers prior to performing other operations on the file. What happens is that the changes you make are stored in the disk cache, waiting for idle time, and the attribute change is performed before the new data is written. It is even possible to delete a file before the data is written, which will give the same error message. Alternatively, the file will fail to be deleted because the cache logic has a handle to that file open at that instance.In contrast, NT/2000 has a better cache algorythm and will flush the buffer prior to altering the attributes.
About the only real way around this is for Kixtart to forcibly flush the buffers at the end of all file write operations. Of course that would require a change at source code level.