ensuring kegg client input stream is closed and add tests cases