Fix error caused by previous fix.

If there are no notifications and it times out instead, then it was trying to use a closed pgsql connection.