Implement AutoCloseable for NetworkConnection

The abstract class NetworkConnection needs to have AutoCloseable