Close file properly after sending them