Added test for premature closing