make sure reading has finished when waiting