The train will leave either way. If you have not managed to fill all the boxes before the train left, you will not get a reward for sending out the train. Once the train has left, you will be able to see which goods you will need to load up the next train.