Fix connection not ending