Putting in a hacky fix for this onclose thing