calls custom notfound handler only if body has not been written yet