Ensure output temp files reflect extensions of output destinations (inputs already did this).

- Refactor inputs & outputs to use same filename generator
- Add tests