Driver entered trailer (post-unload) to clean out residual coal from trailer walls. Lockout was not applied to gates. Electrical failure (assumed at this point) caused the gates to close. Driver wedged the shovel between gates but gates on his legs caused a broken right leg and soft tissue damage in the left. Note: the reporting period for the 7000-1 was inadvertently overlooked.