Make sure to destroy context after thread gets joined