What you've done with @ViewChild('warningModal') warning is get the TemplateRef you used as in your modal, not the actual NgbModalRef.
It depends how you open up your modal, if you open it programmatically you should receive the NgbModalRef object which you could call .close on.