closes file before sleeping, so other processes can access it