Create temporary file in the same directory
Without providing the selected name as pattern for the temp file it will
be created in a complete different area (/tmp on *nix systems). This
change will create the temporary file in the same directory so that
renaming it is an atomic operation.