fix to make default temp dir in get_tmp_filename work across platforms

This should help with a lot of the ``/tmp`` issues we've run into over the years. @jrrideout, @gavinhuttley, @rob-knight, @wasade, do you see any issues with this?