Fix fclose on null file pointer.
Add basic curl code.