Updated temp file creation error checks