error handling for freopen()