Return after emitting error (avoid creating write stream)

Without this change, the target file is still created on a 404.