Can a doctor just stop my pain med?

Yes. If it's not medically necessary, there is reason to believe you are addicted and diverting it for another purpose, or you are using illegal drugs while taking the pill, then the doctor may have medical cause for stopping it. These are the most common reasons. But, there may be others. A doctor has the right to refuse any treatment if he/she feels there is a valid medical or safety reason.