[secp256k1] Avoid calling fclose(...) with an invalid argument
Summary: Backport PR498 from practicalswift
Test Plan:
ninja check-secp256k1
Reviewers: #bitcoin_abc, schancel
Reviewed By: #bitcoin_abc, schancel
Subscribers: teamcity
Differential Revision: https://reviews.bitcoinabc.org/D1259