I feel like this open and close check in the same spot could be the source of trouble, or am I wrong?  Is it possible that open and close would get called back to back?