fix open/closed logic

http://manage.dimagi.com/default.asp?132578