One tricky thing that Photoshop actions have is  that if you want to include commands like open or save on it, you MUST record that commands as part of your action, in that way you will have all your new files with a different name each.
In my opinion it's not a good idea to use the same name, temp.jpg in a Photoshop action.
Other way to solve this, is that you take out of your PS action any open/save commands and use AppleScript to do this job.

Hope this help

Carlos Ysunza