Properly close TLS connections

refs #6724