Updated: close connection + error reporting