added window loading, closing, and refreshing