Check that the input values for (f)close() are sane to prevent crashing.
Check that the input values for (f)close() are sane to prevent crashing.

Simplify logic while here.

rene0/dcf77pi,rene0/dcf77pi