Fix resource leakage

Only last commit is important (Fix resource leakage by first call buffer release and then iterator.remove). The others are approaches to fix outdated java docs, typos and other smaller non functional refactorings. 
I use IntelliJ and it highlights all the outdated java docs and typos...

EDIT: Actually after more testing the leak is still not gone, though it comes less frequently.