periodic_closing with smarter sinces