what literally device is used un the phrase "lockers slammed shutike a rhythmic beat

The phrase "lockers slammed shut like a rhythmic beat" is a figure of speech known as simile, comparing the action of lockers slamming shut to the rhythmic beat. Therefore, no literal device is being used in this specific phrase.