Create temporary files in user's temp folder

Create temporary files in user's temp folder rather than the program
folder to avoid possible permissions problems.