The closing operation in coolapi_close_all should be in reverse order.