Core/Transports: Fixed crashes caused by invalid leftover transport references

Closes #12282