Fix a crash when quitting while playing