fixing exception when closing while playing