changed usage of connection.end to connection.fin (as it sends close message).

Updated usage of debug to debugLog.