Clear interval first before disconnecting to prevent the user from connecting again