Attempt to fix closing not working sometimes.