When a connection was closed or died, cursor should be invalidated/closed too.
That means closed should be implemented as getter/setter function and should check the following conditions:
- is connection alive
- is statement valid
- is statement error code==CR_STMT_CLOSED
Additionally the MARIADB_CHECK_STMT macro should also check if the error code is CR_STMT_CLOSED.