closing datafile before sending it