Fixes multiple extension installation error

This is somewhat related to #5257 but more directly related to the comment from @bchintx on #5330. If you install one extension and then install another extension, you can get into a condition where you get an error because it tries to reuse the same temp file for storing the zip file.

In this pull request, I switch to a more robust temp file handler (the same one used by the package-validator). Note that I actually changed temp file libraries during this pull request, because this new library provides a convenience routine for getting a temporary stream.

I also added a function that more aggressively deletes the temporary directory to which extensions are extracted.