Fix potential NPE in logs when closing the river