During the first train robbery, the train goes from being stationary at the crossing to traveling at 10 or 12 mph in about three seconds, and only by traveling thirty or forty feet from where it was stopped while doing so. Trains cannot accelerate this quickly, as a car can.
When Deidra and Laney rob their first train, they see a police unit stopped at the train crossing as they slowly roll by it. To hide, Laney jumps off the side of the flatcar and Deidra opens the door and gets into the container. The officer sees the light from their flashlight on the side of the container and gets on board the (now stopped) train to investigate. The officer subsequently shines his light on Laney, who is camouflaged among some trackside debris, and then notices the container latch is open, with the security band obviously missing. The officer simply closes and latches the container before getting off of the train.
No law enforcement officer who had gotten on board the train to specifically investigate possible criminal activity in this situation would simply just close the latch without opening it to investigate if there were someone inside and stealing from it, which was the reason he got on board in the first place.