Removed a needless String variable

Change-Id: I767b2d6e464a300d36193e34d91924ae38ce0ca4
Added closing of many IO resources, fixing PMD warnings

Change-Id: I4fbaf0b9eb9c3f4e2f9fb226ee46dc5e12a10126