Replaced connection.disconnect() to inputStream.close()