use tempdir instead of tempname in test/pkg.jl

since tempname creates a file on windows, but the goal here is creating
a directory. also don't try to delete nonexistent files during cleanup

ref https://github.com/JuliaLang/julia/pull/8942#issuecomment-64090329 https://github.com/JuliaLang/julia/issues/9053#issuecomment-64090435 https://github.com/JuliaLang/julia/issues/9045#issuecomment-64090279

pr is against release-0.3, will forward-port if it looks okay on travis