BUG: Use a safe temporary path for download

Change extension downloading to use a temporary file for the download
location. This ensures that a: we don't clutter the temporary directory
with old downloads, b: multiple users can download the same extension
using a shared temporary directory (e.g. most UNIX-like systems), and c:
the file name is not predictable, which is a security vulnerability.

Issue #3552