fixed problem with premature closes