MFC: r264421

Free resources in error cases; re-indent a curly brace while here.

CID:		1199366
Found with:	Coverity Prevent(tm)
MFC: r264479

Fix double fclose() in an error case.

CID:		1006120
Found with:	Coverity Prevent(tm)