It is unphysical, but probably not due to any error in your script (although it's possible), but rather due to the Krylov method used to calculate the transmission spectrum. Sometime it fails numerically, which can give negative transmission. In 12.2 and later we have fixed this (in as many cases as possible), but as I wrote above, if you want to be on the safe size, use Recursion or Direct instead. It's slower, however.