fix open/closed logic

http://manage.dimagi.com/default.asp?132578
Merge pull request #4226 from dimagi/opm

fix open/closed logic