fixed scanner not closing