Properly close input streams in the applicationContext merge process

Sorry about the previous spam. I missed a few things. Hopefully everything is according to your standards.