Fixed file descriptor leak that occurs after certain types of failures.
Fixed file descriptor leak that occurs after certain types of failures.

PR:		3516
Submitted by:	Matthew Flatt <mflatt@cs.rice.edu>

jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase