Also flush the after-commit-queue in other places

JSONRPC, scheduler, etc.