Fixed an issue with context.close()