Exercise 17 add close connection to die function