Close BufferedReader and InputStream even if a exception was thrown.
Check if NetworkInterface enumeration is not null before using it.