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
StopNode()
** 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:

error:

Cat debug.log again...

...
Failed to rename wallet_foo.dat to wallet.[secs since epoch as float].bak
Error:
Shutdown: In progress...
scheduler thread interrupt
StopRPCThreads: waiting for async rpc workers to stop
StopNode()
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 https://www.reddit.com/r/Bitcoin/comments/3rdacy/concerning_bitcoin_core_issue/
Another case was https://github.com/bitcoin/bitcoin/issues/1969, 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.