Remove unused imports, fix build.properties, close streams in tests