NULLify closed db and don't call db_last on a closed db in ip_refresh