Close the connection via defer