Fix the memory leak and actually close the resources. #1898
This should fix #1888
I've opted for direct rename of getInputStream => openInputStream which technically can break people depending on it in 1.7.13 but in reality I doubt anyone started using that interface.
But I guess I can add a deprecated getInputStream back.