again, close connection and shutdown are two different tasks IMHO, btw a delete directory is missing, isnt it?