rib: Properly terminate when a critical error occurs

Change-Id: I0acd44d0f0bba808f8a049527708cf01a6f56eaa
Fixes: #1567