move more close() statements into finally {}