server closes when there is an error