When by mistake a wrong sentence is passed, the court may, before or immediately after it is recorded, amend the sentence.