Terminally ill Scots are 'dying in pain' due to 'inadequate'