Fix part of bug #2885 (fprintf on a NULL file pointer)