Corrected the destroy context function.