make Rio work when TMPDIR does not end with a trailing slash

This change makes Rio work when $TMPDIR does not end with a trailing slash and the user lacks write permissions on $TMPDIR's parent directory.

For example, on one of my Ubuntu machines, my TMPDIR is set to /tmp/user/1001 (where 1001 is my userid) and /tmp/user/ is owned by root, mode 711.