Lawyer's license cancelled for locking courtroom