end outputs when input is finished