Fixed bad usage of rstrip() that caused test failure.

If the temporary file name contained a p or y as its last
characters, it would be stripped. refs #23083.