ensure closing all resources in close() if throwing IOException
update javadoc