(PUP-3153) Guard against nil when closing Uniquefiles

In a recent commit we introduced `Uniquefile` to use in place
of `Tempfile` for certain code paths.  Because `Uniquefile` does
not automatically delete files for you, it is necessary to call
`close!` explicitly if you wish to make sure that they get
removed.

In the original commit I did this in a few places in an `ensure`
block.  However, I did not guard against the possibility that
an error might occur when attempting to instantiate the `Uniquefile`
object (e.g., file permissions error), and thus the calls to `close!`
in the `ensure` blocks may result in a NilClass exception (and also
mask the real error).

This commit adds guards to ensure that we only try to call `close!`
if the `Uniquefile` object was actually instantiated.
We're moving to legislating against `and` in favor of `&&` in puppet code. This isn't enforced yet, but any objections to changing to `&&` here?