fix issue with ->close() in api