closing stream properly - using 1.6 constructs since travis didn't like building this on OpenJDK 1.7