leverage constants from Hadoop source code and better exception handle when closing multiple steams