Metric Dimension of Bounded Width Graphs