Test case for #1509
Fix #1509
Merge pull request #1510 from sjinks/issue-1509

Fix assertion failure on unclean shutdown