shell: Add the rest.close() to close the rest channel

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
shell: Fix TypeError exception when leaving docker page

Fixes #1010
Closes #1017

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>