WebAPI automatic closing

Hi, Recently our WebAPI is not closing automatically, its held after midnight. How can we automatically close the web API batch?