fix close not being called