Close all shells fix (fixes #575)