Sleeping and waking when window is reopened