Improve connection termination