Changed closed flag to 'isOpen'.

This should be less error prone.