function refreshTextLayer(layer) {
  layer.adjustFrameToFit()
  layer.select_byExtendingSelection(true, false)
  layer.setIsEditingText(true)
  layer.setIsEditingText(false)
  layer.select_byExtendingSelection(false, false)
}
Refreshes text layer boundaries after setting text. This is used as Sketch
sometimes forgets to resize the text layer.

@param layer