Try to fix the payday deadlock

Despite numerous attempts I haven't been able to reproduce #2637 in a test, so I can't be sure that this PR will actually fix the problem, but I'm hopeful.