Fixes NullPointerException caused by sorting the tree when closing a game that is in progress.

Author: nfbrown