ENH: remove insecure mktemp use

mktemp only returns a filename, a malicous user could replace it before
it gets used.
Merge pull request #4262 from juliantaylor/mktemp-remove

remove insecure mktemp usage