[#1880] Fix file handle leaks

... in VirtualFile.content and VirtualFile.contentAsString

The most important fix is in file VirtualFile (first commit b4afb68).
Other commits are minor fixes & code cleanup.
WRITE_BUFFER_SIZE can be removed as you don't use it anymore