Gamma-ray bursts (GRBs) are intense pulses of high-energy emission associated with the death of massive stars or compact objects’ coalescence. Their multiwavelength observations help verify the reliability of the standard fireball model. We analyze 14 GRBs observed contemporaneously in gamma rays by the Fermi Large Area Telescope, in X-rays by the Swift Telescope, and in the optical bands by Swift and many ground-based telescopes. We study the correlation between the spectral and temporal indices using closure relations according to the synchrotron forward-shock model in a stratified medium (n ∝ r
−k
) with k ranging from 0 to 2.5. We find that the model without energy injection is preferred over the one with energy injection in all the investigated wavelengths. In gamma rays, we only explored the ν > max{ν
c
, ν
m
} (slow cooling, SC/fast cooling, FC) cooling condition (where ν
c
and ν
m
are the cooling and characteristic frequencies, namely the frequencies at the spectral break). In the X-ray and optical bands, we explored all the cooling conditions, including ν
m
< ν < ν
c
(SC), ν
c
< ν < ν
m
(FC), and SC/FC, and found a clear preference for SC for X-rays and SC/FC for optical. Within these cooling conditions, X-rays exhibit the highest rate of occurrence for the density profile with k = 0, while the optical band has the highest occurrence for k = 2.5 when considering no energy injection. Although we can pinpoint a definite environment for some GRBs, we find degeneracies in other GRBs.