Fixed issue where server crashes when client closes connection