shell: only check for active shell when closing if it is set

Solves the bug:

shell foo
shell bar
shell foo
close_shell foo
close_shell bar
Merge pull request #20 from neg/bugfix

shell: only check for active shell when closing if it is set