Fix disconnect method to close connection