Thanks for running the test on more platforms, Myrna.
If the shell and the OS, possibly Java as well, aren't able to cooperate properly, there isn't much we can do except to accept both error messages.
Unless you discover something crucial, I would suggest we allow both 25502 and 40XD1.
Another experiment you can do, is to enable the line setting directories to read-only (currently commented out). This is not a solution to the problem, but it may get you past the current point of failure. The test should then fail when trying to delete the files instead.