Used QUIT command instead of s.close()