Changed test, so it doesn't rely on java 7 autoClosable feature.