Updated mkstemp function for windows