Bismillah ArRahman ArRaheem
Bad exists when good is removed. Only good comes from Allahﷻ, so what ever is bad comes from the creations themselves and the choices that they make.
In terms of guidance, Allahﷻ does not close the guidance upon those who do bad but rather, they close it upon themselves with their insistence on not seeing the truth and their stubbornness.
" God did not wrong them, they wronged themselves. " 3:117
Please note - The ayahs of the Holy Qur'an where it appears that it is Allahﷻ that is closing the door of guidance needs to be read in conjunction with other Ayahs and with in the context of the narrative to avoid falling in the trap of misunderstanding the Holy Qur'an by thinking that it is Allahﷻ that takes guidance away from the people and predestines them to hell.