             
             # Execute the query
             try
+                if @state.cursor?
+                    @state.cursor.close?
                 # Separate queries
                 @non_rethinkdb_query = '' # Store the statements that don't return a rethinkdb query (like "var a = 1;")
                 @index = 0 # index of the query currently being executed

                        skip_value: @skip_value
                        execution_time: new Date() - @start_time
                        query: @query
                        has_more_data: @cursor.hasNext()

                    @results_view.render_result
                        results: @current_results # The first parameter is null ( = query, so we don't display it)

            @results_view.destroy()
            @history_view.destroy()
            @driver_handler.destroy()
            if @state.cursor?
                @state.cursor.close()

            @display_normal()
            $(window).off 'resize', @display_full
