You should try increasing k-point sampling for DOS calculation. I have attached a modified script that does that and also it includes 2 methods to compute DOS; for your system, you should decrease the Gaussian broadening such that the spectrum is not too broadened to close the gap.
I would also advise to use a more general analysis object (also available through GUI),
https://docs.quantumatk.com/manual/Types/LocalDensityOfStates/LocalDensityOfStates.html, where you may change this broadening parameter and even set DOS method to tetrahedron method that does not require broadening parameter, but it requires a number of k-points, as used in the script enclosed.