Return name and handle of a temporary file safely