separate receive message and close connection