Added disconnect and stream closing to finally closes #1497