close open period in API controller, with tests