Database corruption and wallet empty, thank you Error 22

Generated a dozen wallets, specified one of the wallets with -wallet param, bootstrapped zcashd as normal, generated some addresses, cashed out funds from pool X, transferred .000001 from a t to z address, closed wallet 30 minutes later and we get the following put:

Error: Error: A fatal internal error occurred, see debug.log for details

Cat debug.log...

scheduler thread interrupt
addcon thread interrupt
msghand thread interrupt
net thread interrupt
Shutdown: In process...
RPCAcceptHandler: Error: Operation canceled
StopRPCThreads: waiting for async rpc workers to stop
** System error while flushing: CDB: Error 22, can't open database
Error: Error: A fatal internal ...

Try and attach wallet with -wallet again and get a blank error:


Cat debug.log again...

Failed to rename wallet_foo.dat to wallet.[secs since epoch as float].bak
Shutdown: In progress...
scheduler thread interrupt
StopRPCThreads: waiting for async rpc workers to stop
Shutdown: done

Then run file on wallet_foo.dat and get wallet_foo.dat: empty.

Searched if anyone else had hit a similar error signal and came across something in the past with bitcoin core, accept this was related to a random program crash and not a ensued fatal error as result of a user terminating the process
Another case was, but still it had almost zero resemblance to my case.

No backups of the wallet were made seeing as transactions were just in the hundred zookoshis being played with.

Have tried to reproduce, going through the exact same steps previously and have failed so far in coming any where close to the original.
For those who want to use -wallet, just be sure to backup before hand.