added bug and connection close in quit method