Fix for BUG#41330 -Myisam table open count set to zero before index blocks                     are written.        When we have a myisam table with DELAY_KEY_WRITE option, index updates are not applied until the flush tables command is issued or until the server is shutdown. If server gets killed before the index updates are  written to disk, the index file is corrupted as expected but the table  is not marked as crashed. So when we start server with myisam-recover, table is not repaired leaving the table unusable.        The problem is when we try to write the index updates to index file, we decrement the open_count even before the flushing the keys to index file.        Fixed by moving the decrement operation after flushing the keys to the index file. So we always have non zero open count if the flush table operation is killed and when the server is started with mysiam-recover option, it marks the table as crashed and repairs it.        Note: No testcase for added as we need to kill the server and start the        server with different set of options and other non trivial       operations involved.
Fix for BUG#41330 -Myisam table open count set to zero before index blocks 
                   are written.
      
When we have a myisam table with DELAY_KEY_WRITE option, index updates
are not applied until the flush tables command is issued or until the
server is shutdown. If server gets killed before the index updates are 
written to disk, the index file is corrupted as expected but the table 
is not marked as crashed. So when we start server with myisam-recover,
table is not repaired leaving the table unusable.
      
The problem is when we try to write the index updates to index file,
we decrement the open_count even before the flushing the keys to index
file.
      
Fixed by moving the decrement operation after flushing the keys to the
index file. So we always have non zero open count if the flush table
operation is killed and when the server is started with mysiam-recover
option, it marks the table as crashed and repairs it.
      
Note: No testcase for added as we need to kill the server and start the 
      server with different set of options and other non trivial
      operations involved.
natsys/mariadb_10.2,davidl-zend/zenddbi,flynn1973/mariadb-aix,ollie314/server,natsys/mariadb_10.2,ollie314/server,ollie314/server,flynn1973/mariadb-aix,natsys/mariadb_10.2,natsys/mariadb_10.2,davidl-zend/zenddbi,davidl-zend/zenddbi,ollie314/server,davidl-zend/zenddbi,ollie314/server,flynn1973/mariadb-aix,ollie314/server,davidl-zend/zenddbi,natsys/mariadb_10.2,davidl-zend/zenddbi,ollie314/server,davidl-zend/zenddbi,flynn1973/mariadb-aix,flynn1973/mariadb-aix,flynn1973/mariadb-aix,flynn1973/mariadb-aix,davidl-zend/zenddbi,slanterns/server,natsys/mariadb_10.2,natsys/mariadb_10.2,natsys/mariadb_10.2,natsys/mariadb_10.2,davidl-zend/zenddbi,flynn1973/mariadb-aix,ollie314/server,natsys/mariadb_10.2,ollie314/server,flynn1973/mariadb-aix,flynn1973/mariadb-aix,natsys/mariadb_10.2,ollie314/server,ollie314/server,davidl-zend/zenddbi,flynn1973/mariadb-aix,davidl-zend/zenddbi