MB-12138 Add function for generating temporary filename

mkstemp was not generating a unique file name on windows and
it was causing problem in sorting the data while using temporary files.
Due to which index building was failing. Added a new function to
generate temporary files.

Change-Id: If87d84dacbfe931e6ef1f0217405c0d6b63359d9
Reviewed-on: http://review.couchbase.org/41480
Reviewed-by: Sarath Lakshman <sarath@couchbase.com>
Tested-by: buildbot <build@couchbase.com>