Replace deprecated mktemp() by mkstemp()

mktemp() is considered harmful since python-2.3:
https://docs.python.org/2/library/tempfile.html#tempfile.mktemp