Fix error in onClosing