Addressed an Xcode alert of using mktemp

Quote from Xcode:
>Call to function mktemp is insecure as it always creates or uses
insecure temporary file. Use mkstemp instead