hwrt/utils.py: Refactored create_pfile() to use temporary files