MB-11403 create new tmpfile if tmpfile() fails

Recently we have seen failures in tmpfile() calls on VMs where
the /tmp folder is mapped to a ramdisk which may get full
Instead of having compactions fail, create a new tmpfile from the
target_filename and use that instead of failing compaction.
Change-Id: I28dadb46df422586d59c13a8d1ffeda3f6511ed5
Reviewed-on: http://review.couchbase.org/38245
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: abhinav dangeti <abhinav@couchbase.com>