Fix issue where closing object wouldn't deselect it

Fixes #308