Make assert_close more robust