                 window.conn.close()
             catch err
                 #console.log 'Could not destroy connection'
+            @cursor.close()
             clearTimeout @timeout
     
     class @InputQuery extends Backbone.View

                    @current_results.push data
                return false

        # Callback for multiple queries
        callback_multiple_query: (data) =>
            # If we get a run time error
            if data instanceof rethinkdb.errors.RuntimeError
                @.$('.loading_query_img').css 'display', 'none'
                @.results_view.render_error(@query, data)
                return false

            @current_query_index++
            if @current_query_index is @queries.length-1
                if @cursor?
                    @cursor.close()
                @cursor = eval(@queries[@current_query_index])
                @cursor.next(@callback_query)
            else
                if @cursor?
                    @cursor.close()
                @cursor = eval(@queries[@current_query_index])
                @cursor.next(@callback_multiple_query)

            return false
           

        # Function triggered when the user click on 'more results'
        show_more_results: (event) =>
            try

                @start_time = new Date()
                @current_results = []
                @skip_value = 0

                tagged_callback = @create_tagged_callback()
                @cursor = eval(@queries[@current_query_index])
                @cursor.next(tagged_callback)

            catch err
                @.$('.loading_query_img').css 'display', 'none'
                @results_view.render_error(@query, err)

        # Separate the queries so we can execute them in an synchronous order
        separate_queries: (query) =>
            start = 0
            count_dot = 0
