Made user window close properly