TCP errors can cause a panic due to defer before handling err