Destroy AL context before closing old device

I refuse to compile this code, so it's not tested.
This should fix the segfault in alcDestroyContext.
Merge branch 'pr884'