diff -Naur a/Python-2.7.10/Modules/_bsddb.c b/Python-2.7.10/Modules/_bsddb.c --- a/Python-2.7.10/Modules/_bsddb.c 2015-05-23 21:39:16.000000000 +0530 +++ b/Python-2.7.10/Modules/_bsddb.c 2015-07-24 09:52:04.686443560 +0530 @@ -3454,6 +3454,8 @@ error=DB_close_internal(self, 0, 1); if (error) { + if (outFile) + fclose(outFile); return error; } }