fix close client connection
connection error handling in scripts